Set single-card dual-ip

Environment are as follows:

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)

Installation select MiniSetup

-------------------------------------------------------------------------

1, to root

2, execute ip addr command, view the card name

3, execution 

vi / etc / sysconfig / network-scripts / ifcfg-ens33 Command (NIC my name is ens33)

4, modify the file

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=6a3a1cfd-974a-41e8-bd4c-e7dadcaef7e1
DEVICE=ens33
ONBOOT=yes

IPADDR=192.168.138.128
IPADDR1=192.168.138.129
NETMASK=255.255.255.0
GATEWAY=192.168.138.2
DNS1=61.139.2.69
DNS2=202.98.96.68

Save and exit

5, the implementation of systemctl restart network command to restart the network card

6, execute ip addr command, you can see there are two ip address of the next card

7, execute the command ping www.baidu.com, you can ping be the successful

Note: after the first IPADDR not with numbers

 

 

Guess you like

Origin www.cnblogs.com/tianyingz/p/11813378.html