当前位置: 技术问答>linux和unix
一快网卡怎么设二个IP地址?
来源: 互联网 发布时间:2015-02-07
本文导语: 在linux下,一快网卡怎么设二个IP地址?在什么地方设? | 方法一: #添加到/etc/rc.d/rc.local 尾部 #setting up IP alias interfaces #/sbin/ifconfig eth0:0 192.168.11.4 netmask 255.255.255.0 broadcast 192.168.11.255 ...
在linux下,一快网卡怎么设二个IP地址?在什么地方设?
|
方法一:
#添加到/etc/rc.d/rc.local 尾部
#setting up IP alias interfaces
#/sbin/ifconfig eth0:0 192.168.11.4 netmask 255.255.255.0 broadcast 192.168.11.255 up
#setting up the routes
echo "Setting IP routes ..."
/sbin/route add -host 192.168.0.2 eth0:0
方法二
#创建此文件/etc/sysconfig/network-scripts/ifcfg-eth0:0
#ifcfg-eth0:0
DEVICE=eth0:0
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
PEERDNS=no
GATEWAY=
##Add to tail of /etc/sysconfig/static-routes
eth0:0 host 192.168.0.2
推进这种方法
#添加到/etc/rc.d/rc.local 尾部
#setting up IP alias interfaces
#/sbin/ifconfig eth0:0 192.168.11.4 netmask 255.255.255.0 broadcast 192.168.11.255 up
#setting up the routes
echo "Setting IP routes ..."
/sbin/route add -host 192.168.0.2 eth0:0
方法二
#创建此文件/etc/sysconfig/network-scripts/ifcfg-eth0:0
#ifcfg-eth0:0
DEVICE=eth0:0
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
PEERDNS=no
GATEWAY=
##Add to tail of /etc/sysconfig/static-routes
eth0:0 host 192.168.0.2
推进这种方法
|
login root
edit /etc/tcp
locate ifconfig .... (copy this line)
paste next line (change IP and netmask...)
save and reboot
Good luck
edit /etc/tcp
locate ifconfig .... (copy this line)
paste next line (change IP and netmask...)
save and reboot
Good luck