10/06 6

Ubuntu 下网卡的配置(单网卡双IP设置) 不指定

jason , 22:02 , 我的收藏 » Server , 评论(0) , 引用(0) , 阅读(2237) , Via 本站原创 | |
sudo vi /etc/network/interfaces

//这个应该是决定是否启用这个端口

auto eth0

//静态设置IP

iface eth0 inet static
address 172.16.146.200
netmask 255.255.255.0
#broadcast 172.16.146.255
gateway 172.16.146.254
//通过dhcp动态设置

iface eth0 inet dhcp

//设置DNS服务器

sudo vi /etc/resolv.conf

nameserver 202.96.128.68
nameserver 61.144.56.101
nameserver 192.168.8.220
//重新设置网络,以启用新设置

sudo /etc/init.d/networking restart

ubuntu下一个网卡设置多个IP
要加一个 192.168.0.111 的 ip
sudo ifconfig eth0:0 192.168.0.111 up
就搞定了。

如果需要开机自动绑定的话,
就写到 /etc/network/interfaces 中,仿照 eth0 写个 eth0:0

auto eth0
iface eth0 inet static
address 192.168.0.5
netmask 255.255.255.0
gateway 192.168.0.1

auto eth0:0
iface eth0:0 inet static
address 192.168.0.25
netmask 255.255.255.0
gateway 192.168.0.1
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]