您好,欢迎来到汇智旅游网。
搜索
您的当前位置:首页Ubuntu临时和永久修改ip地址掩码和网关

Ubuntu临时和永久修改ip地址掩码和网关

来源:汇智旅游网

查看网卡信息

终端输入 ifconfig 并回车,查看需要修改的网卡名称

临时修改

sudo ifconfig 网卡名 ip信息 netmask 掩码
  1. 修改网关的方法
    (route -n查看网关)
    使用route命令修改网卡的网关信息
sudo route add default gw 网关信息 网卡名

永久修改

1.修改配置文件

永久修改需要对配置文件进行修改,然后重启网络服务即可

Ubuntu系统进行网络配置涉及到的配置文件

  1. /etc/network/interfaces IP等信息的配置文件

  2. /etc/resolv.conf DNS服务器的配置文件

sudo vim /etc/network/interfaces

静态ip(static ip)配置,常用于桥接模式下用于于主机通讯.其他设置可以参照(eth0配置静态IP,eth1配置成自动获取):

# The loopback network interface
auto lo
iface lo inet loopback

# static ip
auto eth0
iface eth0 inet static
address 192.168.43.100
netmask 255.255.255.0
gateway 192.168.43.1

# dynamic ip
auto eth1
iface eth1 inet dhcp
2.重启服务
sudo /etc/init.d/networking restart
或
sudo service networking restart

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- hzar.cn 版权所有 赣ICP备2024042791号-5

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务