Posts for: #Linux

Test ethernet cables with two local interfaces

  1. Connect (usb) ethernet adapters and some cable between them
  2. Disable both interfaces from network settings / network manager

network settings

  1. Check interface visibility
# ip a | grep enx
enx7cc2c6448e83: <BROADCAST,MULTICAST,UP,LOWER_UP>
enx60a4b7ddea36: <BROADCAST,MULTICAST,UP,LOWER_UP>
  1. Setup first interface
# add IP address to 1st interface
ip a add 10.10.10.10/24 dev enx7cc2c6448e83
  1. Setup new network namespace and second interface
# create new network namespace
ip netns add lan2

# move 2nd interface to new namespace
ip link set enx60a4b7ddea36 netns lan2

# bring up 2nd interface
ip netns exec lan2 ip link set dev enx60a4b7ddea36 up

# add IP address to 2nd interface
ip netns exec lan2 ip a add 10.10.10.11/24 dev enx60a4b7ddea36
  1. Test connection between interfaces
# ping 10.10.10.11

PING 10.10.10.11 (10.10.10.11) 56(84) bytes of data.
64 bytes from 10.10.10.11: icmp_seq=1 ttl=64 time=0.755 ms
64 bytes from 10.10.10.11: icmp_seq=2 ttl=64 time=0.743 ms
64 bytes from 10.10.10.11: icmp_seq=3 ttl=64 time=1.03 ms

3 packets transmitted, 3 received, 0% packet loss, time 2087ms
[Read more]