Linux IP Masquerade HOWTO

David A. Ranch

November 13, 2005

November 13, 2005

This document describes how to enable the Linux IP Masquerade feature on a given Linux host. IP Masquerade is a form of Network Address Translation or NAT which NAT allows internally connected computers that do not have one or more registered Internet IP addresses to communicate to the Internet via the Linux server's Internet IP address.


Table of Contents
1. Introduction
1.1. Introduction to IP Masquerading or IP MASQ
1.2. Foreword, Feedback & Credits
1.3. Copyright & Disclaimer
2. Background Knowledge
2.1. What is IP Masquerade?
2.2. Current Status
2.3. Who Can Benefit From IP Masquerade?
2.4. Who Doesn't Need IP Masquerade?
2.5. How does IP Masquerade Work?
2.6. Requirements for IP Masquerade on Linux 2.4.x
2.7. Requirements for IP Masquerade on Linux 2.2.x
2.8. Requirements for IP Masquerade on Linux 2.0.x
3. Setting Up IP Masquerade
3.1. Compiling a new kernel if needed
3.2. Checking your existing kernel for MASQ functionality
3.2.1. Compiling Linux 2.4.x Kernels
3.2.2. Compiling Linux 2.2.x Kernels
3.2.3. Compiling Linux 2.0.x Kernels
3.3. Assigning Private Network IP Addresses to the Internal LAN
3.4. Configuring IP Forwarding Policies
3.4.1. Configuring IP Masquerade on Linux 2.6.x and 2.4.x Kernels
3.4.2. Configuring IP Masquerade on Linux 2.2.x Kernels
3.4.3. Configuring IP Masquerade on Linux 2.0.x Kernels
4. Configuring the other internal to-be MASQed machines
4.1. Configuring Microsoft Windows 95 and OSR2
4.2. Configuring Windows NT
4.3. Configuring Windows for Workgroup 3.11
4.4. Configuring UNIX Based Systems
4.5. Configuring DOS using NCSA Telnet package
4.6. Configuring MacOS Based System Running MacTCP
4.7. Configuring MacOS Based System Running Open Transport
4.8. Configuring Novell network using DNS
4.9. Configuring OS/2 Warp
4.10. Configuring OS/400 on a IBM AS/400
4.11. Configuring Other Systems
5. Testing IP Masquerade
5.1. Loading up the rc.firewall ruleset
5.2. Testing internal MASQ client PC connectivity
5.3. Testing internal MASQ client to MASQ server connectivity
5.4. Testing internal MASQ server connectivity
5.5. Testing internal MASQ server to MASQ client connectivity
5.6. Testing External MASQ server Internet connectivity
5.7. Testing internal MASQ client to external MASQ server connectivity
5.8. Testing external MASQ ICMP forwarding
5.9. Testing MASQ functionality without DNS
5.10. Testing MASQ functionality with DNS resolution
5.11. Testing more MASQ functionality with DNS
5.12. Any remaining functional, performance, etc. issues...
6. Other IP Masquerade Issues and Software Support
6.1. Problems with IP Masquerade
6.2. Incoming services
6.3. Supported Client Software and Other Setup Notes
6.3.1. Network Clients that -Work- with IP Masquerade
6.3.2. Clients that do not have full support in IP MASQ:
6.4. Stronger firewall rulesets to run after initial testing
6.4.1. Stronger IP Firewall (IPTABLES) rulesets
6.4.2. Stronger IP Firewall (IPCHAINS) rulesets
6.4.3. Stronger IP Firewall (IPFWADM) Rulesets
6.5. IP Masquerading multiple internal networks
6.5.1. iptables support for multiple internal lans
6.5.2. ipchains support for multiple internal lans
6.5.3. ipfwadm support for multiple internal lans
6.6. IP Masquerade and Dial-on-Demand Connections
6.7. Port Forwarding with IPTABLES or external tools like IPPORTFW, IPMASQADM, IPAUTOFW, REDIR, UDPRED, and other Port Forwarding tools
6.7.1. IPTABLES-based PORTFWD'ing: Using IPTABLES's PREROUTING option for 2.6.x and 2.4.x kernels
6.7.2. IPMASQADM-based PORTFWD'ing: Using IPMASQADM with 2.2.x kernels
6.7.3. IPPORTFW-based PORTFWD'ing: Using IPPORTFW on 2.0.x kernels
6.8. CU-SeeMe and Linux IP-Masquerade
6.9. Mirabilis ICQ
6.10. Gamers: The LooseUDP patch
7. Frequently Asked Questions
7.1. ( Distro ) - What Linux Distributions support IP Masquerading?
7.2. ( Requirements ) - What are the minimum hardware requirements and any limitations for IP Masquerade? How well does it perform?
7.3. ( Errors ) - When I run my specific rc.firewall-* ruleset, I get "command not found" errors. Why?
7.4. ( Still wont work ) - I've checked all my configurations, I still can't get IP Masquerade to work. What should I do?
7.5. ( Email list ) - How do I join or view the IP Masquerade and/or IP Masqurade Developers mailing lists and archives?
7.6. ( NAT vs. Proxy ) - How does IP Masquerade differ from Proxy or NAT services?
7.7. ( GUI ) - Are there any GUI firewall creation/management tools?
7.8. ( MASQ and Dynamic IPs ) - Does IP Masquerade work with dynamically assigned IP addresses?
7.9. ( MASQ and various networks ) - Can I use a cable modem (both bi-directional and with modem returns), DSL, satellite link, etc. to connect to the Internet and use IP Masquerade?
7.10. ( Dial on Demand ) - Can I use Diald or the Dial-on-Demand feature of PPPd with IP MASQ?
7.11. ( Apps ) - What applications are supported with IP Masquerade?
7.12. ( Distro Setup ) - How can I get IP Masquerade running on Redhat, Debian, Slackware, etc.?
7.13. ( Timeouts ) - Connections seem to break if I don't use them often. Why is that?
7.14. ( Odd Behavior ) - When my Internet connection first comes up, nothing works. If I try again, everything then works fine. Why is this?
7.15. ( MTU ) - IP MASQ seems to be working fine but some sites don't work. This usually happens with WWW and some FTP sites.
7.15.1. Enabling PMTU Clamping for PPPoE and some PPP Users:
7.15.2. Clamping the MSS via IPTABLES:
7.15.3. Changing the External MTU of the MASQ server:
7.15.4. Changing the MTU of various operating systems:
7.16. ( FTP ) - MASQed FTP clients don't work.
7.17. ( Performance ) - IP Masquerading seems slow
7.18. ( PORTFW ) - IP Masquerading with PORTFWing seems to break when my line is idle for long periods
7.19. ( PORTFW - Locally ) - I can't reach my PORTFWed server from the INTERNAL lan
7.20. ( Logs ) - Now that I have IP Masquerading up, I'm getting all sorts of weird notices and errors in the SYSLOG log files. How do I read the IPTABLES/IPCHAINS/IPFWADM firewall errors?
7.21. ( Log Reduction ) - My logs are filling up with packet hits due to the new "stronger" rulesets. How can I fix this?
7.22. ( MASQ Security ) - Can I configure IP MASQ to allow Internet users to directly contact internal MASQed servers?
7.23. ( Free Ports ) - I'm getting "kernel: ip_masq_new(proto=UDP): no free ports." in my SYSLOG files. Whats up?
7.24. ( SETSOCKOPT ) - I'm getting "ipfwadm: setsockopt failed: Protocol not available" when I try to use IPPORTFW!
7.25. ( SAMBA ) - Microsoft File and Print Sharing and Microsoft Domain clients don't work through IP Masq!
7.26. ( IDENT ) - IRC won't work properly for MASQed IRC users. Why?
7.27. ( IRC DCC ) - mIRC doesn't work with DCC Sends
7.28. ( IP Aliasing ) - Can IP Masquerade work with only ONE Ethernet network card?
7.29. ( Multiple-LANs ) - I have two MASQed LANs but they cannot communicate with each other!
7.30. ( SHAPING ) - I want to be able to limit the speed of specific types of traffic
7.31. ( ACCOUNTING ) - I need to do accounting on who is using the network
7.32. ( MULTIPLE IPs - DMZ segments) - I have several EXTERNAL IP addresses that I want to PORTFW to several internal machines. How do I do this?
7.33. ( 1:1 NAT ) - I'd like to do 1:1 NAT but I can't figure out how to do it
7.34. ( Netstat ) - I'm trying to use the NETSTAT command to show my Masqueraded connections but its not working
7.35. ( VPNs ) - I would like to get Microsoft PPTP (GRE tunnels) and/or IPSEC (Linux SWAN) tunnels running through IP MASQ
7.36. ( Games ) - I want to get the XYZ network game to work through IP MASQ but it won't work. Help!
7.37. ( Stops working ) - IP MASQ works fine for a while but then it stops working. A reboot seems to fix this. Why?
7.38. ( SMTP Relay ) - Internal MASQed computers cannot send SMTP or POP-3 mail!
7.39. ( Source Routing ) - I need different internal MASQed networks to exit on different external IP addresses
7.40. ( IPCHAINS rulesets on 2.4.x kernels ) - What the ipchains.o module can do on 2.4.x kernels
7.41. ( IPTABLES vs. IPCHAINS vs. IPFWADM ) - Why do the 2.4.x, 2.2.x, and 2.0.x kernels use different firewall systems?
7.42. ( Upgrades ) - I've just upgraded to the x.y.z kernel, why isn't IP Masquerade working?
7.43. ( EQL ) - I need help with EQL connections and IP Masq
7.44. ( Wussing out ) - I can't get IP Masquerade to work! What options do I have for Windows Platforms?
7.45. ( Developers ) - I want to help with IP Masquerade development. What can I do?
7.46. ( More INFO ) - Where can I find more information on IP Masquerade?
7.47. ( Translators ) - I want to translate this HOWTO to another language, what should I do?
7.48. ( Updates ) - This HOWTO seems out of date, are you still maintaining it? Can you include more information on ...? Are there any plans for making this better?
7.49. ( Thanks ) - I got IP Masquerade working, it's great! I want to thank you guys, what can I do?
8. Miscellaneous
8.1. Useful Resources
8.2. Linux IP Masquerade Resource
8.3. Thanks to the following supporters..
8.4. Reference
8.5. ChangeLOG

mirror server hosted at Truenetwork, Russian Federation.