카테고리 없음

iptables 명령어

Taemy 2020. 10. 1. 14:31

DNAT, SNAT 삽입하기

iptables -I PREROUTING 1 -t nat -j DNAT -p <prot e.g. udp/tcp> -s <xxx.xxx.xxx.xxx/xx> -d <xxx.xxx.xxx.xxx/xx> --to-destination <xxx.xxx.xxx.xxx>

iptables -I POSTROUTING 1 -t nat -j SNAT -p <prot e.g. udp/tcp> -o <interface> -s <xxx.xxx.xxx.xxx/xx> -d <xxx.xxx.xxx.xxx/xx> --to-source <xxx.xxx.xxx.xxx>

 

DNAT 확인하기

iptables -t nat -nvL PREROUTING

 

SNAT 확인하기

iptables -t nat -nvL POSTROUTING