linux单网卡双IP配置方法-05互联
>

帮助中心 / linux单网卡双IP配置方法

linux单网卡双IP配置方法

时间:2018/8/3 11:20:43

[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1C:C0:D4:EA:97  
          inet addr:61.147.75.43  Bcast:61.147.75.63  Mask:255.255.255.224
          inet6 addr: fe80::21c:c0ff:fed4:ea97/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:331322 errors:0 dropped:0 overruns:0 frame:0
          TX packets:171013 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:145853129 (139.0 MiB)  TX bytes:56238822 (53.6 MiB)
          Interrupt:50

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1884 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1884 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:767005 (749.0 KiB)  TX bytes:767005 (749.0 KiB)

[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# cp ifcfg-eth0 ifcfg-eth0:1
[root@localhost network-scripts]# vi ifcfg-eth0:1
# Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller
DEVICE=eth0:1
BOOTPROTO=static
HWADDR=00:1C:C0:D4:EA:97
IPADDR=112.84.189.43
NETMASK=255.255.255.224
ONBOOT=yes
"ifcfg-eth0:1" 7L, 200C written
[root@localhost network-scripts]# service network restart
正在关闭接口 eth0:                                        [确定]
关闭环回接口:                                             [确定]
弹出环回接口:                                             [确定]
弹出界面 eth0:                                            [确定]
[root@localhost network-scripts]#