KBT/Using NAT on Ubuntu

From AptivateOER

< KBT
Jump to: navigation, search
Contents
Contents
BMO Training KENET
Timetable
Training Objectives
Documentation
Appendix
Participants

View contents and print

[Edit contents] [Edit template]

[edit] 1 Source NAT

  • The packets originates from a private network and its destined to a public network through a gateway.
  • When leaving the gateway, its Private IP is changed to the gateways Public IP address
  • Example of a SNAT rule
iptables -t nat -A POSTROUTING -p icmp --icmp-type echo-request -j MASQUERADE

[edit] 2 Destination NAT

  • Using DNAT for all protocols (and ports) on one IP
iptables -t nat -A PREROUTING -d 10.1.1.83 -j DNAT --to-destination 41.204.160.3
  • Using DNAT for a single port
iptables -t nat -A PREROUTING -p tcp -d 10.1.1.83 --dport 80 -j DNAT --to-destination 41.204.160.3
Personal tools
Create a book