1.使用MACVLAN复制网路接口并设置mac地址
root@host:/root$ip link add link eth0 dev peth0 type macvlan
root@host:/root$ifconfig  peth0 hw ether 00:26:9e:45:93:f4
root@host:/root$ifconfig -a
eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet addr:192.168.0.164  Bcast:192.168.1.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:311400 errors:0 dropped:9 overruns:0 frame:0
          TX packets:174993 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:370761737 (353.5 MiB)  TX bytes:13131529 (12.5 MiB)
          Interrupt:47 Base address:0x2000


peth0     Link encap:Ethernet  HWaddr 00:26:9e:45:93:f4 
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
2.为新网路接口设置IP地址
root@host:/root$ifconfig peth0 192.168.0.165
root@host:/root$ifconfig
eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet addr:192.168.0.164  Bcast:192.168.1.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:364427 errors:0 dropped:67 overruns:0 frame:0
          TX packets:204809 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:438931700 (418.5 MiB)  TX bytes:15023122 (14.3 MiB)
          Interrupt:47 Base address:0x2000


peth0     Link encap:Ethernet  HWaddr 00:26:9e:45:93:f4 
          inet addr:192.168.0.165  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2558 errors:0 dropped:6 overruns:0 frame:0
          TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:572927 (559.4 KiB)  TX bytes:14832 (14.4 KiB)
3.设置新路由
root@host:/root$ip route replace default scope global nexthop via  192.168.0.1 dev eth0 nexthop via 192.168.0.1 dev peth0
root@host:/root$ip route
default
nexthop via 192.168.0.1  dev eth0 weight 1
nexthop via 192.168.0.1  dev peth0 weight 1
192.168.0.0/24 dev peth0  proto kernel  scope link  src 192.168.0.165
192.168.0.0/23 dev eth0  proto kernel  scope link  src 192.168.0.164