标签:restart service ns3 ip add ubuntu ace roo nbsp reboot
lichengbei
2019-12-21
修改网络配置文件,注意只给一个网口配置gateway,系统会生成一条默认路由:
root@ubuntu-lichengbei:~# vim /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# interface
auto ens38
iface ens38 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
auto ens33
iface ens33 inet static
address 172.16.0.10
netmask 255.255.0.0
network 172.16.0.0
broadcast 172.16.255.255
# nameserver
dns-nameservers 223.5.5.5
dns-nameservers 223.6.6.6
# route
up route add -net 172.17.0.0 netmask 255.255.0.0 gw 172.16.0.10 dev ens33
service networking restart重启网络生效,reboot当然也可以
网络配置命令参考:
ifconfig -a
ifconfig ens38 192.168.0.2 netmask 255.255.255.0
ip addr flush dev ens38
ifconfig ens38 down
ifconfig ens38 up
标签:restart service ns3 ip add ubuntu ace roo nbsp reboot
原文地址:https://www.cnblogs.com/lichengbei/p/12079199.html