Add a new card in vm ubuntu 16.04, the same network segment different ip

Add a new card in vm ubuntu 16.04, the same network segment different ip

Source  https://blog.51cto.com/744478/2083672

 

In vm ubuntu 16.04 in added a new piece of card, but does not display, you can see with ifcnfig -a,
execution

$ifconfig ens38 up

Display error

View online can reinstall vmtools to reinstall the network card driver
1, load the CD-ROM

$sudo mkdir /mnt/cdrom
$sudo mount /dev/cdrom  /mnt/cdrom

2. Go to the temporary directory, copy the installation files

$cd /tmp
$tar zxpf /mnt/cdrom/VMwareTools-x.x.x-yyyy.tar.gz

3, installation vmtools

$cd vmware-tools-distrib
$sudo ./vmware-install.pl

Enter on the way
$sudo reboot
I operate this way, do sudo ifconfig ens38 up, you can see the new normal network card. But after the restart still can not see the card.

Edit / etc / network / interfaces, add

auto ens33                                     #网卡一
iface ens33 inet static address 192.168.1.30 netmask 255.255.255.0 gateway 192.168.1.1

auto ens38                                     #网卡二
iface ens38 inet static address 192.168.1.31 netmask 255.255.255.0

Configuring Routing solve multiple network adapters, the same network segment, different ip same MAC problems, different ping IP, but the return of the mac address is the same, will lead off the network.

$sudo su root
# echo "210 ens33table" >> /etc/iproute2/rt_tables #子路由表ens33table # echo "220 ens38table" >> /etc/iproute2/rt_tables #子路由表ens38table

Exit 0 in the /etc/rc.local file; add the following to the front


ip route add 192.168.1.0/24 dev ens33 src 192.168.1.30 table ens33table ip route add 192.168.1.0/24 dev ens38 src 192.168.1.31 table ens38table ip route add default dev ens33 via 10.110.6.1 table ens33table ip route add default dev ens38 via 10.110.6.1 table ens38table ip rule add from 192.168.1.30 table ens33table ip rule add from 192.168.1.31 table ens38table :wq # reboot 或 #ip route flush cache

ping 192.168.1.30
ping 192.168.1.31 arp -a 192.168.1.30 00-0c-29-bf-e7-f9 动态 192.168.1.31 00-0c-29-bf-e7-03 动态

At this point you can see the mac address is not the same

If the virtual machine is clone or copied to other non places to work should do the following work
1, modify / etc / network / interfaces are not the card name and ip address information
2, modify / etc / iproute2 / information rt_tables in this step may not modify, change is intended primarily because nes33table, nes38table in nes33, nes38 is the name of the virtual machine network card, but also to modify and match the new environment.
3, modify the /etc/rc.local. This place would modify ip address, name of the child routing table, and to match the new environment.

 

============= End

 

Guess you like

Origin www.cnblogs.com/lsgxeva/p/11535877.html