Linux IP Masquerade HOWTO

David A. Ranch

v2.00.1118 November 18, 2001

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. 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.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 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.6. IP Masquerade and Dial-on-Demand Connections
6.7. IPPORTFW, IPMASQADM, IPAUTOFW, REDIR, UDPRED, and other Port Forwarding tools
6.7.1. 2.4.x PORTFWD'ing: Using IPTABLE's PREROUTING option for 2.4.x kernels
6.7.2. 2.2.x PORTFWD'ing: Using IPMASQADM with 2.2.x kernels
6.7.3. 2.0.x 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. When I run the rc.firewall command, I get "command not found" errors. Why?
7.4. I've checked all my configurations, I still can't get IP Masquerade to work. What should I do?
7.5. How do I join or view the IP Masquerade and/or IP Masqurade Developers mailing lists and archives?
7.6. How does IP Masquerade differ from Proxy or NAT services?
7.7. ( GUI ) - Are there any GUI firewall creation/management tools?
7.8. Does IP Masquerade work with dynamically assigned IP addresses?
7.9. 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. 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. 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. 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 FTP.
7.15.1. Changing the MTU of a PPP link:
7.15.2. Old UNIX Serial interfaces:
7.15.3. PPPoE Users:
7.15.4. Linux:
7.15.5. MS Windows 95:
7.15.6. MS Windows 98:
7.15.7. MS Windows NT 4.x
7.15.8. MS Windows 2000
7.16. MASQed FTP clients don't work.
7.17. ( Performance ) - IP Masquerading seems slow
7.18. IP Masquerading with PORTFWing seems to break when my line is idle for long periods
7.19. 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 IPFWADM/IPCHAINS firewall errors?
7.20. Can I configure IP MASQ to allow Internet users to directly contact internal MASQed servers?
7.21. I'm getting "kernel: ip_masq_new(proto=UDP): no free ports." in my SYSLOG files. Whats up?
7.22. I'm getting "ipfwadm: setsockopt failed: Protocol not available" when I try to use IPPORTFW!
7.23. ( SAMBA ) - Microsoft File and Print Sharing and Microsoft Domain clients don't work through IP Masq! To properly support Microsoft's SMB protocol, an IP Masq module would need to be written but there are three viable work-arounds. For more details, please see this Microsoft KnowledgeBase article.
7.24. ( IDENT ) - IRC won't work properly for MASQed IRC users. Why?
7.25. ( DCC ) - mIRC doesn't work with DCC Sends
7.26. ( IP Aliasing ) - Can IP Masquerade work with only ONE Ethernet network card?
7.27. ( MULTI-LAN ) - I have two MASQed LANs but they cannot communicate with each other!
7.28. ( SHAPING ) - I want to be able to limit the speed of specific types of traffic
7.29. ( ACCOUNTING ) - I need to do accounting on who is using the network
7.30. ( MULTIPLE IPs ) - I have several EXTERNAL IP addresses that I want to PORTFW to several internal machines. How do I do this?
7.31. I'm trying to use the NETSTAT command to show my Masqueraded connections but its not working
7.32. ( VPNs ) - I would like to get Microsoft PPTP (GRE tunnels) and/or IPSEC (Linux SWAN) tunnels running through IP MASQ
7.33. ( Games ) - I want to get the XYZ network game to work through IP MASQ but it won't work. Help!
7.34. IP MASQ works fine for a while but then it stops working. A reboot seems to fix this. Why?
7.35. ( SMTP Relay ) - Internal MASQed computers cannot send SMTP or POP-3 mail!
7.36. ( IPROUTE2 ) - I need different internal MASQed networks to exit on different external IP addresses
7.37. Why do the new 2.1.x and 2.2.x kernels use IPCHAINS instead of IPFWADM?
7.38. I've just upgraded to the 2.2.x kernels, why isn't IP Masquerade working?
7.39. I've just upgraded to a 2.0.38+ kernels later, why isn't IP Masquerade working?
7.40. I need help with EQL connections and IP Masq
7.41. ( Wussing out ) - I can't get IP Masquerade to work! What options do I have for Windows Platforms?
7.42. ( Developers ) - I want to help with IP Masquerade development. What can I do?
7.43. Where can I find more information on IP Masquerade?
7.44. ( Translators ) - I want to translate this HOWTO to another language, what should I do?
7.45. 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.46. 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. Changes