My local setup is CentOS installed(hosted in vmware) in Ubuntu machine
These are the steps i.e. needed to perform in ubuntu machine
1)Enable IP forwarding
#vi /etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
2)Forward the port to the virtual machine (I needed to forward my ubuntu machine 8081 port to 80 port of vmware machine)
#iptables -A INPUT -p tcp --dport 8081 -j ACCEPT
3)Changing in vmware nat.conf file to accept forwarded traffic
#vi /etc/vmware/vmnet8/nat/nat.conf
[incomingtcp]
# Use these with care - anyone can enter into your VM through these...
# The format and example are as follows:
#<external port number> = <VM's IP address>:<VM's port number>
8081 = 172.16.3.128:80
4)stop and start ufw (May be not necessary)
5)After shutting down vmware.Restart vmware via
#/etc/init.d/vmware restart
After performing all these steps try to access <this computer ip>:8081 via another network and it is responded by vmware hosted machine.
(For testing purpose you can check the traffic on both machine
i)In ubuntu machine(i.e. accepting 8081 port)
#tcpdump -i any "port 8081"
ii)Vmware hosted machine that is accepting 80 port
#tcpdump -i any "port 80"
)
These are the steps i.e. needed to perform in ubuntu machine
1)Enable IP forwarding
#vi /etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
2)Forward the port to the virtual machine (I needed to forward my ubuntu machine 8081 port to 80 port of vmware machine)
#iptables -A INPUT -p tcp --dport 8081 -j ACCEPT
3)Changing in vmware nat.conf file to accept forwarded traffic
#vi /etc/vmware/vmnet8/nat/nat.conf
[incomingtcp]
# Use these with care - anyone can enter into your VM through these...
# The format and example are as follows:
#<external port number> = <VM's IP address>:<VM's port number>
8081 = 172.16.3.128:80
4)stop and start ufw (May be not necessary)
5)After shutting down vmware.Restart vmware via
#/etc/init.d/vmware restart
After performing all these steps try to access <this computer ip>:8081 via another network and it is responded by vmware hosted machine.
(For testing purpose you can check the traffic on both machine
i)In ubuntu machine(i.e. accepting 8081 port)
#tcpdump -i any "port 8081"
ii)Vmware hosted machine that is accepting 80 port
#tcpdump -i any "port 80"
)
No comments:
Post a Comment