Answer the question
In order to leave comments, you need to log in
How to set up NAT on linux?
There are two servers with Linux. The first acts as a router, it has two network interfaces, one of which is connected to the Internet, the other to the local network. The second server is connected to the local network. The task is to configure the router so that the second server has access to the Internet and is accessible from the Internet.
On the router I applied the following rules:
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -i eth1 -o eth2 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth2 -o eth1 -j ACCEPT
# sysctl -p
net.ipv4.ip_forward = 1
Answer the question
In order to leave comments, you need to log in
More specifics are needed, for example, external IP 123.123.123.123 local network 192.168.0.0/24 then I would write it like this:
iptables
it is not clear what "available from the Internet" means to you?
if the internal server is WEB and its port is 80 and the address is 192.168.0.2, then it will be accessible from outside
iptables -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question