Linux IP Masquerade HOWTO
David A. Ranch
dranch@trinnet.net
v2.00.041902, April 19, 2002
Интересное, кроссплатформенное руководство по сетевому маскарадингу
[spoilerСодержание]Chapter 1. Introduction.....................................................................................................................................1
1.1. Introduction to IP Masquerading or IP MASQ.................................................................................1
1.2. Foreword, Feedback & Credits.........................................................................................................1
1.3. Copyright & Disclaimer....................................................................................................................2
Chapter 2. Background Knowledge..................................................................................................................3
2.1. What is IP Masquerade?...................................................................................................................3
2.2. Current Status..................................................................................................................................3
2.3. Who Can Benefit From IP Masquerade?..........................................................................................4
2.4. Who Doesn't Need IP Masquerade?.................................................................................................4
2.5. How does IP Masquerade Work?.....................................................................................................4
2.6. Requirements for IP Masquerade on Linux 2.4.x.............................................................................7
2.7. Requirements for IP Masquerade on Linux 2.2.x.............................................................................9
2.8. Requirements for IP Masquerade on Linux 2.0.x...........................................................................11
Chapter 3. Setting Up IP Masquerade............................................................................................................13
3.1. Compiling a new kernel if needed..................................................................................................13
3.2. Checking your existing kernel for MASQ functionality.................................................................13
3.2.1. Compiling Linux 2.4.x Kernels......................................................................................15
3.2.2. Compiling Linux 2.2.x Kernels......................................................................................23
3.2.3. Linux 2.0.x Kernels........................................................................................................29
3.3. Assigning Private Network IP Addresses to the Internal LAN......................................................34
3.4. Configuring IP Forwarding Policies...............................................................................................34
3.4.1. Configuring IP Masquerade on Linux 2.4.x Kernels......................................................35
3.4.2. Configuring IP Masquerade on Linux 2.2.x Kernels......................................................43
3.4.3. Configuring IP Masquerade on Linux 2.0.x Kernels......................................................49
Chapter 4. Configuring the other internal to−be MASQed machines ........................................................56
4.1. Configuring Microsoft Windows 95 and OSR2.............................................................................56
4.2. Configuring Windows NT..............................................................................................................58
4.3. Configuring Windows for Workgroup 3.11....................................................................................58
4.4. Configuring UNIX Based Systems.................................................................................................59
4.5. Configuring DOS using NCSA Telnet package.............................................................................59
4.6. Configuring MacOS Based System Running MacTCP..................................................................60
4.7. Configuring MacOS Based System Running Open Transport.......................................................61
4.8. Configuring Novell network using DNS........................................................................................62
4.9. Configuring OS/2 Warp..................................................................................................................63
4.10. Configuring OS/400 on a IBM AS/400........................................................................................63
4.11. Configuring Other Systems..........................................................................................................63
Chapter 5. Testing IP Masquerade ................................................................................................................64
5.1. Loading up the rc.firewall ruleset...................................................................................................64
5.2. Testing internal MASQ client PC connectivity..............................................................................64
5.3. Testing internal MASQ client to MASQ server connectivity.........................................................65
5.4. Testing internal MASQ server connectivity...................................................................................65
5.5. Testing internal MASQ server to MASQ client connectivity.........................................................66
5.6. Testing External Internet connectivity............................................................................................66
5.7. Testing internal MASQ client to external MASQ server connectivity...........................................68
5.8. Testing external MASQ ICMP forwarding.....................................................................................69
5.9. Testing MASQ functionality without DNS....................................................................................70
5.10. Testing MASQ functionality with DNS resolution......................................................................70
5.11. Testing more MASQ functionality with DNS..............................................................................71
5.12. Any remaining functional, performance, etc. issues.....................................................................71
Chapter 6. Other IP Masquerade Issues and Software Support .................................................................72
6.1. Problems with IP Masquerade........................................................................................................72
6.2. Incoming services..........................................................................................................................72
6.3. Supported Client Software and Other Setup Notes.........................................................................72
6.3.1. Network Clients that −Work− with IP Masquerade.......................................................72
6.3.2. Clients that do not have full support in IP MASQ:.........................................................76
6.4. Stronger firewall rulesets to run after initial testing.......................................................................76
6.4.1. Stronger IP Firewall (IPTABLES) rulesets....................................................................76
6.4.2. Stronger IP Firewall (IPCHAINS) rulesets....................................................................85
6.4.3. Stronger IP Firewall (IPFWADM) Rulesets...................................................................91
6.5. IP Masquerading multiple internal networks..................................................................................97
6.6. IP Masquerade and Dial−on−Demand Connections.......................................................................98
6.7. IPPORTFW, IPMASQADM, IPAUTOFW, REDIR, UDPRED, and other Port Forwarding
tools......................................................................................................................................................98
6.7.1. 2.4.x PORTFWD'ing: Using IPTABLE's PREROUTING option for 2.4.x kernels......99
6.7.2. 2.2.x PORTFWD'ing: Using IPMASQADM with 2.2.x kernels..................................101
6.7.3. 2.0.x PORTFWD'ing: Using IPPORTFW on 2.0.x kernels.........................................103
6.8. CU−SeeMe and Linux IP−Masquerade........................................................................................105
6.9. Mirabilis ICQ...............................................................................................................................105
6.10. Gamers: The LooseUDP patch..................................................................................................108
Chapter 7. Frequently Asked Questions.......................................................................................................110
7.1. ( Distro ) − What Linux Distributions support IP Masquerading?...............................................110
7.2. ( Requirements ) − What are the minimum hardware requirements and any limitations for
IP Masquerade? How well does it perform?.......................................................................................111
7.3. ( Errors ) − When I run the rc.firewall command, I get "command not found" errors. Why?.....111
7.4. ( Still wont work ) − I've checked all my configurations, I still can't get IP Masquerade to
work. What should I do?....................................................................................................................112
7.5. ( Email list ) − How do I join or view the IP Masquerade and/or IP Masqurade Developers
mailing lists and archives?..................................................................................................................112
7.6. ( NAT vs. Proxy ) − How does IP Masquerade differ from Proxy or NAT services?..................113
7.7. ( GUI ) − Are there any GUI firewall creation/management tools?.............................................115
7.8. ( MASQ and Dynamic IPs ) − Does IP Masquerade work with dynamically assigned IP
addresses?...........................................................................................................................................115
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?...........115
7.10. ( Dial on Demand ) − Can I use Diald or the Dial−on−Demand feature of PPPd with IP
MASQ?...............................................................................................................................................115
7.11. ( Apps ) − What applications are supported with IP Masquerade?............................................115
7.12. ( Distro Setup ) − How can I get IP Masquerade running on Redhat, Debian, Slackware,
etc.?.....................................................................................................................................................116
7.13. ( Timeouts ) − Connections seem to break if I don't use them often. Why is that?...................116
7.14. ( Odd Behavior ) − When my Internet connection first comes up, nothing works. If I try
again, everything then works fine. Why is this?.................................................................................117
7.15. ( MTU ) − IP MASQ seems to be working fine but some sites don't work. This usually
happens with WWW and FTP.............................................................................................................117
7.15.1. Changing the MTU of a PPP link:..............................................................................118
7.15.2. Old UNIX Serial interfaces:.......................................................................................118
7.15.3. PPPoE Users:..............................................................................................................118
7.15.4. Linux:.........................................................................................................................119
7.15.5. MS Windows 95:........................................................................................................119
7.15.6. MS Windows 98:........................................................................................................120
7.15.7. MS Windows NT 4.x..................................................................................................121
7.15.8. MS Windows 2000.....................................................................................................121
7.16. ( FTP ) − MASQed FTP clients don't work................................................................................122
7.17. ( Performance ) − IP Masquerading seems slow........................................................................122
7.18. ( PORTFW ) − IP Masquerading with PORTFWing seems to break when my line is idle
for long periods...................................................................................................................................124
7.19. ( 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 IPFWADM/IPCHAINS firewall errors?..........124
7.20. ( MASQ Security ) − Can I configure IP MASQ to allow Internet users to directly contact
internal MASQed servers?..................................................................................................................126
7.21. ( Free Ports ) − I'm getting "kernel: ip_masq_new(proto=UDP): no free ports." in my
SYSLOG files. Whats up?.................................................................................................................126
7.22. ( SETSOCKOPT ) − I'm getting "ipfwadm: setsockopt failed: Protocol not available"
when I try to use IPPORTFW!............................................................................................................126
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........................................................................................................127
7.24. ( IDENT ) − IRC won't work properly for MASQed IRC users. Why?....................................127
7.25. ( IRC DCC ) − mIRC doesn't work with DCC Sends.................................................................128
7.26. ( IP Aliasing ) − Can IP Masquerade work with only ONE Ethernet network card?.................128
7.27. ( Multiple−LANs ) − I have two MASQed LANs but they cannot communicate with each
other!...................................................................................................................................................129
7.28. ( SHAPING ) − I want to be able to limit the speed of specific types of traffic.........................129
7.29. ( ACCOUNTING ) − I need to do accounting on who is using the network............................129
7.30. ( MULTIPLE IPs ) − I have several EXTERNAL IP addresses that I want to PORTFW to
several internal machines. How do I do this?.....................................................................................130
7.31. ( Netstat ) − I'm trying to use the NETSTAT command to show my Masqueraded
connections but its not working..........................................................................................................130
7.32. ( VPNs ) − I would like to get Microsoft PPTP (GRE tunnels) and/or IPSEC (Linux
SWAN) tunnels running through IP MASQ........................................................................................130
7.33. ( Games ) − I want to get the XYZ network game to work through IP MASQ but it won't
work. Help!.......................................................................................................................................131
7.34. ( Stops working ) − IP MASQ works fine for a while but then it stops working. A reboot
seems to fix this. Why?......................................................................................................................131
7.35. ( SMTP Relay ) − Internal MASQed computers cannot send SMTP or POP−3 mail!...............131
7.36. ( IPROUTE2 ) − I need different internal MASQed networks to exit on different external
IP addresses.........................................................................................................................................132
7.37. ( IPCHAINS vs. IPFWADM ) − Why do the new 2.1.x and 2.2.x kernels use IPCHAINS
instead of IPFWADM?.......................................................................................................................133
7.38. ( Upgrades ) − I've just upgraded to the 2.2.x kernels, why isn't IP Masquerade working?......133
7.39. ( Upgrades cont.) − I've just upgraded to a 2.0.38+ kernels later, why isn't IP Masquerade
working?.............................................................................................................................................134
7.40. ( EQL ) − I need help with EQL connections and IP Masq........................................................134
7.41. ( Wussing out ) − I can't get IP Masquerade to work! What options do I have for
Windows Platforms?...........................................................................................................................134
7.42. ( Developers ) − I want to help with IP Masquerade development. What can I do?................135
7.43. ( More INFO ) − Where can I find more information on IP Masquerade?.................................135
7.44. ( Translators ) − I want to translate this HOWTO to another language, what should I do?......136
7.45. ( 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?..................................136
7.46. ( Thanks ) − I got IP Masquerade working, it's great! I want to thank you guys, what can
I do?....................................................................................................................................................136
Chapter 8. Miscellaneous..............................................................................................................................137
8.1. Useful Resources.........................................................................................................................137
8.2. Linux IP Masquerade Resource....................................................................................................137
8.3. Thanks to the following supporters..............................................................................................138
8.4. Reference.....................................................................................................................................139
8.5. Changes........................................................................................................................................139[/spoiler]
Скачать