Ubuntu配置双IP
sudo vim /etc/network/interfaces 打开IP配置文件
1 auto lo 2 iface lo inet loopback 3 auto eth0 4 iface eth0 inet static 5 #pre-up ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx 6 address 210.47.248.180 7 netmask 255.255.255.0 8 gateway 210.47.248.254 9 nameserver 8.8.8.8 10 auto eth0:0 11 iface eth0:0 inet static 12 address 192.168.3.40 13 netmask 255.255.255.0
pre-up ifconfig eth0 hw ether 为克隆mac地址
auto eth0:0 为增加的IP
Centos 6.5 配置双IP
sudo vim /etc/sysconfig/network-scripts/ifcfg-Auto_eth0
1 HWADDR=74:D0:2B:27:30:FF 2 TYPE=Ethernet 3 BOOTPROTO=none 4 IPADDR=210.47.248.171 5 PREFIX=24 6 GATEWAY=210.47.248.254 7 DNS1=8.8.8.8 8 DEFROUTE=yes 9 IPV4_FAILURE_FATAL=yes 10 IPV6INIT=no 11 NAME="Auto eth0" 12 UUID=3baad9b7-be6c-419b-bfff-c19a3ff1fe60 13 ONBOOT=yes 14 LAST_CONNECT=1405671005 15 IPADDR2=192.168.3.4 16 PREFIX2=24
IPADDR2与PREFIX2为增加ip项,PREFIX值为24等同于子网掩码为255.255.255.0
时间: 2024-11-10 15:58:03