Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- iptables -F
- iptables -F -t nat
- iptables -X -t nat
- iptables -F -t filter
- iptables -X -t filter
- iptables -A INPUT -i lo -j ACCEPT
- iptables -A INPUT -i enp0s3 -j ACCEPT
- iptables -A INPUT -i enp0s8 -s <publiczny_adres_ip_serwera> -j DROP
- iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
- 1)
- sprawdzic mace
- enp0s3
- killall dhclient
- ifconfig enp0s3 192.168.2.1 netmask 255.255.255.0 up
- ifconfig enp0s3 192.168.2.2 netmask 255.255.255.0 up
- ifconfig enp0s3 192.168.2.3 netmask 255.255.255.0 up
- 2)
- echo "1" > /proc/sys/net/ipv4/ip_forward
- iptables -A FORWARD -i <interfejs_wewnętrzny> -o <interfejs_zewnętrzny> -s
- 192.168.xyz.0/24 -d 0/0 -j ACCEPT
- iptables -A FORWARD -i <interfejs_zewnętrzny> -o <interfejs_wewnętrzny> -s 0/0 -d
- 192.168.xyz.0/24 -j ACCEPT
- iptables -t nat -A POSTROUTING -s 192.168.xyz.0/24 -d 0/0 -j MASQUERADE
- route add default gw <ip_routera>
- echo "nameserver 8.8.8.8" > /etc/resolv.conf
- 3) PORT REDIRECT
- iptables -A PREROUTING -t nat -i <interfejs_zewnętrzny> -p tcp -d <adres_IP_routera>
- --dport <nr_portu_na_routerze> -j DNAT --to-destination
- <adres_ip_komputera_wewnątrz_sieci>:<nr_portu>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement