Answer the question
In order to leave comments, you need to log in
How do I configure iptables to run an application on an internal network client machine?
Question on iptables
There is a network of virtual machines raised on VirtualBox
I. The first, let's call it Server, plays the role
of an
OS gateway - Ubuntu Desktop 16.04 LTS
It has two network interfaces:
1) NAT:
enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:d1:38:f2 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
valid_lft 54554sec preferred_lft 54554sec
inet6 fe80::8ca9:6ac7:9b8e:b285/64 scope link
valid_lft forever preferred_lft forever
enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:c4:12:c7 brd ff:ff:ff:ff:ff:ff
inet 192.168.3.1/24 brd 192.168.3.255 scope global enp0s8
valid_lft forever preferred_lft forever
inet6 fe80::3db0:c89c:7b8f:8b5c/64 scope link
valid_lft forever preferred_lft forever
iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
sysctl -w net.ipv4.conf.all.forwarding=1
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:5c:0b:c5 brd ff:ff:ff:ff:ff:ff
inet 192.168.3.70/24 brd 192.168.3.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe5c:bc5/64 scope link
valid_lft forever preferred_lft forever
default via 192.168.3.1 dev eth0
default via 192.168.3.1 dev eth0 metric 204
192.168.3.0/24 dev eth0 scope link
192.168.3.0/24 dev eth0 proto kernel scope link src 192.168.3.70 metric 204
192.168.3.1 dev eth0 scope link
iptables -t nat -A PREROUTING -p tcp --dport 9080 -j REDIRECT --to-ports 8443
iptables -t nat -A PREROUTING -p tcp --dport 9081 -j REDIRECT --to-ports 8443
ssl 0.0.0.0 8443
sudo iptables -t mangle -A PREROUTING -p tcp --dport 9080 -j DROP
sudo iptables -t mangle -A PREROUTING -p tcp --dport 9081 -j DROP
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question