版权声明:此文乃鄙人辛辛耕耘制作,饮其流者怀其源,请标明出处,跪谢!!! https://blog.csdn.net/CSDN_LJie/article/details/82895729
linux添加第二个ip
ifconfig
用法:
ifconfig [nic]:0 [IP-Address] netmask [mask] up
例子:
ifconfig eth0:0 192.168.1.2 netmask 255.255.255.0 up
ip
用法:
ip address add [ip]/[mask-digits] dev [nic]
eg:
ip address add 192.168.99.37/24 dev eth0
永久生效的方法
# vim /etc/network/interfaces
auto eht0
iface eth0 inet dhcp
auto eth0:1
iface eth0:1 inet static
address 192.168.0.1
gateway 192.168.0.254
netmask 255.255.255.0
重启
/etc/init.d/networking restart