$ssh -L 10.140.15.64:8081:192.168.56.20:80 vagrant@192.168.56.20
password: vagrant
* Run this command in baremetal node "10.140.15.64".
* 10.140.15.64 === IP of baremetal node where vagrant with virtualbox is running.
* 192.168.56.20 === Hostonly adapter IP of virtualbox VM running on baremetal node
* We can access horizon running in 192.168.56.20 from our laptop like http://10.140.15.64:8081/dashboard
1)
configuration of bare-metal node where vagrant VM is running
a)
physical interface of baremetal node
$ ifconfig eth3 <====
eth3 Link encap:Ethernet HWaddr 11:11:11:11:11:11
inet addr:10.140.15.64 Bcast:10.140.15.255 Mask:255.255.255.0
inet6 addr: fe80::3aea:a7ff:fe11:7ac9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:86183263 errors:0 dropped:0 overruns:0 frame:0
TX packets:38261525 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26521496912 (26.5 GB) TX bytes:6480246966 (6.4 GB)
b)
Hostonly adapter interface of virtualbox
$ ifconfig vboxnet0 <====
vboxnet0 Link encap:Ethernet HWaddr 0a:00:27:00:00:00
inet addr:192.168.56.1 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:255940 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:79238841 (79.2 MB)
c)
routes in baremetal node
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.140.15.1 0.0.0.0 UG 0 0 0 eth3
10.140.15.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3
169.254.169.254 10.140.15.4 255.255.255.255 UGH 0 0 0 eth3
192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 vboxnet0 <====
2)
configuration of vagrant VM
password: vagrant
* Run this command in baremetal node "10.140.15.64".
* 10.140.15.64 === IP of baremetal node where vagrant with virtualbox is running.
* 192.168.56.20 === Hostonly adapter IP of virtualbox VM running on baremetal node
* We can access horizon running in 192.168.56.20 from our laptop like http://10.140.15.64:8081/dashboard
1)
configuration of bare-metal node where vagrant VM is running
a)
physical interface of baremetal node
$ ifconfig eth3 <====
eth3 Link encap:Ethernet HWaddr 11:11:11:11:11:11
inet addr:10.140.15.64 Bcast:10.140.15.255 Mask:255.255.255.0
inet6 addr: fe80::3aea:a7ff:fe11:7ac9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:86183263 errors:0 dropped:0 overruns:0 frame:0
TX packets:38261525 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26521496912 (26.5 GB) TX bytes:6480246966 (6.4 GB)
b)
Hostonly adapter interface of virtualbox
$ ifconfig vboxnet0 <====
vboxnet0 Link encap:Ethernet HWaddr 0a:00:27:00:00:00
inet addr:192.168.56.1 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:255940 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:79238841 (79.2 MB)
c)
routes in baremetal node
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.140.15.1 0.0.0.0 UG 0 0 0 eth3
10.140.15.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3
169.254.169.254 10.140.15.4 255.255.255.255 UGH 0 0 0 eth3
192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 vboxnet0 <====
2)
configuration of vagrant VM
a)
$ ifconfig br-ex <====
br-ex Link encap:Ethernet HWaddr 08:00:27:ad:e2:80
inet addr:192.168.56.20 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::f474:80ff:fef7:422f/64 Scope:Link
inet6 addr: 2001:db8::2/64 Scope:Global
UP BROADCAST RUNNING MTU:1500 Metric:1
RX packets:676 errors:0 dropped:0 overruns:0 frame:0
TX packets:479 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:119840 (119.8 KB) TX bytes:675959 (675.9 KB)
b)
run tcpdump in br-ex interface to check the traffic
$ sudo tcpdump -i br-ex
http://askubuntu.com/questions/320121/simple-port-forwarding
ReplyDeleteport forwarding with iptables to access horizon running in vagrant VM which run in remote baremetal node
ReplyDeletehttp://fosshelp.blogspot.com/2016/06/port-forwarding-with-iptables-to-access.html
Good article,Need premium plugin,Click here
ReplyDelete