Answer the question
In order to leave comments, you need to log in
How to set up NAT so that you can connect remotely via the Internet to a PC?
example PC with windows 7 operating system with ip 192.168.2.2 connects to the Internet via a PC with Linux OS and ip 192.168.2.1 internal network and ip 192.168.1.2 external network connected to the modem with ip 192.168.1.1 how to write rules in NAT so that you can connect to a PC with windows 7 with ip 192.168.2.2 via the Internet
on the modem set up port forwarding, access to the ports was opened on the PC, if you put the PC on the same network with the modem 1.1, the remote connection works, through the gateway there is no
Answer the question
In order to leave comments, you need to log in
# Allow access from the local network
iptables -A INPUT -i enp1s0 -j ACCEPT
# Allow connections initiated by us from the outside
iptables -A INPUT -i enp4s0 -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow connections via SSH
iptables -A INPUT -i enp4s0 -p tcp --dport ,,,, -j ACCEPT
iptables -A INPUT -i enp4s0 -p tcp --dport ,,,, -j ACCEPT
#,,,, ports #Disallow
incoming from outside
iptables -A INPUT -i enp4s0 -j DROP
# how to write a command allowing access from outside from 192.168.1.1 to 192.168.2.2
# Allow transit connections initiated by us from outside
iptables -A FORWARD -i enp4s0 -o enp1s0 -m state --state ESTABLISHED,RELATED -j ACCEPT
# Disable transit traffic from outside
iptables -A FORWARD -i enp4s0 -o enp1s0 -j DROP
# Enable NAT
iptables -t nat -A POSTROUTING -o enp4s0 -s 192.168.2.0/24 -j MASQUERADE
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question