Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
2.0 kB
2
Indexable
Never
[root@vultr ~]# iptables -t nat -F
[root@vultr ~]#
[root@vultr ~]# iptables -t mangle -F
[root@vultr ~]#
[root@vultr ~]# iptables -F
[root@vultr ~]#
[root@vultr ~]# iptables -X
[root@vultr ~]#
[root@vultr ~]# iptables -t nat -A POSTROUTING -o enp1s0 -j MASQUERADE
[root@vultr ~]#
[root@vultr ~]# iptables -t nat -A POSTROUTING -o vpn0 -j MASQUERADE
[root@vultr ~]#
[root@vultr ~]# iptables-save
# Generated by iptables-save v1.8.10 (nf_tables) on Wed Feb 21 10:17:15 2024
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
# Completed on Wed Feb 21 10:17:15 2024
# Generated by iptables-save v1.8.10 (nf_tables) on Wed Feb 21 10:17:15 2024
*nat
:PREROUTING ACCEPT [5715:318681]
:INPUT ACCEPT [2148:115070]
:OUTPUT ACCEPT [253:18569]
:POSTROUTING ACCEPT [68:4834]
-A POSTROUTING -o enp1s0 -j MASQUERADE
-A POSTROUTING -o vpn0 -j MASQUERADE
COMMIT
# Completed on Wed Feb 21 10:17:15 2024
[root@vultr ~]#
[root@vultr ~]# sysctl -p
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
[root@vultr ~]#
[root@vultr ~]# sysctl -a | grep forwarding | grep ipv4
net.ipv4.conf.all.bc_forwarding = 0
net.ipv4.conf.all.forwarding = 1
net.ipv4.conf.all.mc_forwarding = 0
net.ipv4.conf.default.bc_forwarding = 0
net.ipv4.conf.default.forwarding = 1
net.ipv4.conf.default.mc_forwarding = 0
net.ipv4.conf.enp1s0.bc_forwarding = 0
net.ipv4.conf.enp1s0.forwarding = 1
net.ipv4.conf.enp1s0.mc_forwarding = 0
net.ipv4.conf.lo.bc_forwarding = 0
net.ipv4.conf.lo.forwarding = 1
net.ipv4.conf.lo.mc_forwarding = 0
[root@vultr ~]#
[root@vultr ~]# cat /etc/iptables/iptables.rules
# Generated by iptables-save v1.8.10 (nf_tables) on Mon Feb 19 10:37:45 2024
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [21:1563]
-A POSTROUTING -s 192.168.0.0/24 -o ens3 -j SNAT --to-source 65.20.87.158
-A POSTROUTING -s 192.168.0.0/24 -o ens3 -j SNAT --to-source 65.20.87.158
COMMIT
# Completed on Mon Feb 19 10:37:45 2024
[root@vultr ~]#
Leave a Comment