Unix & Linux Asked by Preeti M Sobarad on November 16, 2021
I have an Ubuntu 16.04 desktop with 2 interface cards. I am trying to route traffic from Windows machine to Ubuntu machine’s enp6s0 interface. I have connected the Windows machine and Ubuntu 16.04 with an Ethernet cable.
From Ubuntu machine’s physical interface, I want to forward the same traffic to docker0(172.17.0.1) and to the docker container(172.17.0.2).
With my current setup, * I have the docker containers with –network bridge so that it has 2 interfaces. and eth1 is configured according to ns3 project ip address.
root@c246ffcf5054:~# ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:ac:11:00:02
inet addr:172.17.0.2 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:107 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:12491 (12.4 KB) TX bytes:1802 (1.8 KB)
eth1 Link encap:Ethernet HWaddr 12:34:88:5d:61:bd
inet addr:10.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1066938 errors:0 dropped:0 overruns:0 frame:0
TX packets:1432799 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1169075120 (1.1 GB) TX bytes:2534973873 (2.5 GB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:151 errors:0 dropped:0 overruns:0 frame:0
TX packets:151 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12768 (12.7 KB) TX bytes:12768 (12.7 KB)
Ubuntu machine has the below ip addresses.
docker0 Link encap:Ethernet HWaddr 02:42:fd:06:5f:68
inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0
inet6 addr: fe80::42:fdff:fe06:5f68/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25096 errors:0 dropped:0 overruns:0 frame:0
TX packets:47902 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1342650 (1.3 MB) TX bytes:76227846 (76.2 MB)
enp5s0 Link encap:Ethernet HWaddr 68:05:ca:26:6f:0a
inet addr:192.168.0.16 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: 2601:641:481:2020:6a05:caff:fe26:6f0a/64 Scope:Global
inet6 addr: fe80::6a05:caff:fe26:6f0a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:193989 errors:0 dropped:0 overruns:0 frame:0
TX packets:109541 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:216544575 (216.5 MB) TX bytes:12131093 (12.1 MB)
Interrupt:16 Memory:fbce0000-fbd00000
enp6s0 Link encap:Ethernet HWaddr f4:6d:04:1a:76:40
inet addr:192.168.100.3 Bcast:192.168.100.255 Mask:255.255.255.0
inet6 addr: fe80::f66d:4ff:fe1a:7640/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10064 errors:0 dropped:0 overruns:0 frame:0
TX packets:4933 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:798388 (798.3 KB) TX bytes:504172 (504.1 KB)
Interrupt:18
I am able to ping Windows machine from Ubuntu machine and docker container. I am able to ping docker 0
and docker containers from Windows machine using the below iptable. But when I run tcpdump in the docker conatiner there is not traffic. Can please somebody help me with this? Thank you!
iptables -t nat -I PREROUTING -i enp6s0 -p tcp -j DNAT --to-destination 172.17.0.1
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP