/[gentoo]/xml/htdocs/doc/en/home-router-howto.xml
Gentoo

Contents of /xml/htdocs/doc/en/home-router-howto.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.62 - (hide annotations) (download) (as text)
Tue Aug 19 14:15:59 2008 UTC (6 years, 4 months ago) by vapier
Branch: MAIN
Changes since 1.61: +8 -3 lines
File MIME type: application/xml
add note for people to try putting the mtu clamp into the mangle table if it doesnt work for them otherwise

1 vapier 1.1 <?xml version='1.0' encoding='UTF-8'?>
2     <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 vapier 1.62 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/home-router-howto.xml,v 1.61 2008/05/20 19:09:36 swift Exp $ -->
4 vapier 1.1
5 vapier 1.36 <guide link="/doc/en/home-router-howto.xml" lang="en">
6 vapier 1.1 <title>Home Router Guide</title>
7    
8     <author title="Author">
9 swift 1.61 <mail link="vapier@gentoo.org">Mike Frysinger</mail>
10 vapier 1.1 </author>
11    
12     <abstract>
13 swift 1.60 This document details how to turn an old Gentoo machine into a router
14 vapier 1.1 for connecting your home network to the internet.
15     </abstract>
16    
17 vapier 1.36 <!-- The content of this document is released into the public domain -->
18     <license/>
19    
20 vapier 1.62 <version>1.39</version>
21     <date>2008-08-19</date>
22 vapier 1.1
23     <chapter>
24     <title>Introduction</title>
25     <section>
26     <body>
27    
28     <p>
29 neysx 1.23 Building your own router out of old spare parts has many advantages over buying
30 swift 1.61 a pre-made canned router by say Linksys. The biggest one by far is control
31     over the connection. The other advantages are left up to your imagination;
32 neysx 1.23 just about anything can be done in this scenario, it's just a matter of needing
33     it.
34 vapier 1.1 </p>
35    
36     <p>
37 neysx 1.23 This guide will show you how to setup Network Address Translation (NAT) on the
38     router (kernel and iptables), add and configure common services (Domain Name
39 nightmorph 1.59 System (DNS) via dnsmasq, dhcp via dhcpcd, ADSL via ppp), and conclude
40 neysx 1.23 with more elaborate and fun things that can be done (port forwarding, traffic
41     shaping, proxies/caching, etc...).
42 vapier 1.1 </p>
43    
44     <p>
45 swift 1.61 Before getting started, there's a few basic requirements you must meet. First,
46 neysx 1.23 you'll need a computer that has at least 2 Network Interface Cards (NICs) in
47 swift 1.61 it. Next, you'll need the configuration settings for your internet connection
48     (may include things like IP/DNS/Gateway/username/password). Finally, you'll
49 neysx 1.23 need a bit of spare time and some Gentoo loving.
50 vapier 1.1 </p>
51    
52     <p>
53     The conventions used in this guide are:
54     </p>
55 neysx 1.23
56 vapier 1.1 <ul>
57     <li>eth0 - NIC connected to the Local Area Network (LAN)</li>
58     <li>eth1 - NIC connected to the Wide Area Network (WAN)</li>
59     <li>LAN utilizes the private 192.168.0.xxx network</li>
60     <li>router is hardcoded to the standard 192.168.0.1 IP</li>
61 vapier 1.3 <li>router is running Linux 2.4 or 2.6; you're on your own with 2.0/2.2</li>
62 vapier 1.1 </ul>
63    
64     <impo>
65 neysx 1.23 Due to security precautions, I would highly suggest you shut down any unneeded
66     services on the router until we have a chance to get the firewall up and
67 swift 1.61 rolling. To view the currently running services, just run <c>rc-status</c>.
68 vapier 1.1 </impo>
69    
70     </body>
71     </section>
72     </chapter>
73    
74     <chapter>
75     <title>Kernel setup (know thyself first)</title>
76     <section>
77     <body>
78    
79     <p>
80 swift 1.61 Your kernel needs to have the drivers running for both your NICs. To see if
81     your cards are already setup, just run <c>ifconfig</c>. Your output may differ
82     slightly from the following, that's fine. What matters is that the interface
83 neysx 1.23 shows up at all.
84 vapier 1.1 </p>
85 neysx 1.23
86 vapier 1.1 <pre caption="Checking NICs">
87     # <i>ifconfig -a</i>
88 swift 1.61 eth0 Link encap:Ethernet HWaddr 00:60:F5:07:07:B8
89     BROADCAST MULTICAST MTU:1500 Metric:1
90     RX packets:0 errors:0 dropped:0 overruns:0 frame:0
91     TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
92     collisions:0 txqueuelen:1000
93     RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
94     Interrupt:11 Base address:0x9800
95    
96     eth1 Link encap:Ethernet HWaddr 00:60:F5:07:07:B9
97     BROADCAST MULTICAST MTU:1500 Metric:1
98     RX packets:0 errors:0 dropped:0 overruns:0 frame:0
99     TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
100     collisions:0 txqueuelen:1000
101     RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
102     Interrupt:10 Base address:0x9400
103 vapier 1.1 </pre>
104 neysx 1.23
105 vapier 1.1 <p>
106 neysx 1.23 If you do not see your two cards showing up and you're not sure what kind of
107 swift 1.61 cards you have, try running <c>lspci | grep Ethernet</c>. You can get that
108     from <c>emerge pciutils</c>. Once you have this information, go into your
109 vapier 1.49 kernel and add support for the correct drivers.
110 vapier 1.1 </p>
111    
112     <p>
113 neysx 1.23 The next thing you'll need is support for iptables and NAT (and packet shaping
114 swift 1.61 if you want). The following list is split up into always required (*),
115 swift 1.60 required only for adsl via PPPoE (a), suggested for everyone (x), and only
116 swift 1.61 for shaper (s) features. It does not matter whether you build the features
117 swift 1.60 into the kernel or as a module so long as when the feature is needed, the
118     correct module(s) are loaded (module loading is left to the reader as a fun
119 neysx 1.23 exercise however).
120 vapier 1.1 </p>
121 neysx 1.23
122 vapier 1.1 <pre caption="Network Options">
123 swift 1.61 Networking options ---&gt;
124     [*] TCP/IP networking
125     [*] IP: advanced router
126     [*] Network packet filtering (replaces ipchains)
127 vapier 1.20 <comment>If you use 2.4.x, you have to enable the following for DHCP:</comment>
128 swift 1.61 [*] Socket Filtering
129 vapier 1.1
130 swift 1.61 IP: Netfilter Configuration ---&gt;
131     [*] Connection tracking (required for masq/NAT)
132     [x] FTP protocol support
133     [x] IRC protocol support
134     [*] IP tables support (required for filtering/masq/NAT)
135     [*] IP range match support
136     [x] MAC address match support
137     [*] Multiple port match support
138     [*] Packet filtering
139     [*] REJECT target support
140     [x] REDIRECT target support
141     [*] Full NAT
142     [*] MASQUERADE target support
143     [s] Packet mangling
144     [s] MARK target support
145     [x] LOG target support
146    
147     QoS and/or fair queueing ---&gt;
148     [s] QoS and/or fair queueing
149     [s] HTB packet scheduler
150     [s] Ingress Qdisc
151    
152     [a] PPP (point-to-point protocol) support
153     [a] PPP filtering
154     [a] PPP support for async serial ports
155     [a] PPP support for sync tty ports
156     [a] PPP Deflate compression
157     [a] PPP BSD-Compress compression
158     [a] PPP over Ethernet
159 vapier 1.1 </pre>
160 neysx 1.23
161 vapier 1.1 <note>
162 vapier 1.51 Some things may be slightly different in a 2.4 vs 2.6 kernel, but you should be
163 swift 1.61 able to figure it out :). Even among 2.6 kernels, these options have a
164     tendency to move around. Good luck!
165 vapier 1.1 </note>
166    
167     </body>
168     </section>
169     </chapter>
170    
171     <chapter>
172     <title>Hug the WAN (a.k.a. The Internet)</title>
173    
174     <section>
175     <title>Intro</title>
176     <body>
177 neysx 1.23
178 vapier 1.1 <p>
179 neysx 1.23 There are many ways to connect to the internet so I'll just cover the ones I'm
180 swift 1.61 familiar with. That leaves us with ADSL (PPPoE) and cable modems
181     (static/dynamic). If there are other methods out there, feel free to write up
182     a little blurb and e-mail me. Feel free to skip any of the following sections
183     in this chapter that don't apply to you. This chapter is just about getting
184 neysx 1.23 the router connected to the internet via eth1.
185 vapier 1.1 </p>
186 neysx 1.23
187 vapier 1.1 </body>
188     </section>
189     <section>
190     <title>ADSL and PPPoE</title>
191     <body>
192    
193     <p>
194 swift 1.60 All the fancy PPPoE software that used to be provided by rp-pppoe
195     (<uri link="http://www.roaringpenguin.com/">Roaring Penguin</uri>) has been
196     integrated into the <uri link="http://samba.org/ppp/">standard PPP
197 swift 1.61 package</uri>. Simply <c>emerge ppp</c> and you'll be on your way. Remember
198     how I said you'll need username/password information? Well I wasn't lying so
199     I hope you have it now! Load up <path>/etc/conf.d/net</path> in your favorite
200 vapier 1.58 editor and set it up.
201 vapier 1.1 </p>
202    
203 vapier 1.8 <note>
204 swift 1.60 In order for the following net settings to work, you must have
205 vapier 1.58 baselayout-1.12.9 or later installed on your system.
206 vapier 1.8 </note>
207    
208 vapier 1.1 <pre caption="Setting up eth1">
209 vapier 1.58 <comment>(Replace 'vla9h924' with your username and 'boogie' with your password)</comment>
210 vapier 1.1
211     # <i>nano /etc/conf.d/net</i>
212 vapier 1.58 <comment>Tell baselayout to use adsl over eth1 for ppp0:</comment>
213     config_ppp0=( "ppp" )
214     link_ppp0="eth1"
215     plugins_ppp0=( "pppoe" )
216     pppd_ppp0=(
217 swift 1.61 "defaultroute"
218     "usepeerdns"
219     <comment>There may be other settings you want, see /etc/conf.d/net.example</comment>
220 vapier 1.58 )
221     username_ppp0="vla9h924"
222     password_ppp0="boogie"
223    
224     # <i>ln -s net.lo /etc/init.d/net.ppp0</i>
225     # <i>rc-update add net.ppp0 default</i>
226     # <i>/etc/init.d/net.ppp0 start</i>
227 vapier 1.1 </pre>
228    
229 vapier 1.3 <warn>
230 swift 1.61 When the DSL interface comes up, it will create ppp0. Although your NIC is
231     called eth1, the IP is actually bound to ppp0. From now on, when you see
232 vapier 1.39 examples that utilize 'eth1', substitute with 'ppp0'.
233 vapier 1.3 </warn>
234 vapier 1.1
235 vapier 1.58 <warn>
236 swift 1.60 Make sure you change the permissions of the /etc/conf.d/net file so that only
237 vapier 1.58 root can read/write it since you're sticking your username/password in it.
238     </warn>
239    
240     <warn>
241 swift 1.60 For people transitioning from the <c>rp-pppoe</c> package, or for people who
242     hit weird connection resets, see the MTU section in the Troubleshooting
243 vapier 1.58 chapter.
244     </warn>
245    
246 vapier 1.1 </body>
247     </section>
248    
249     <section>
250     <title>Cable and/or dynamic/static IP</title>
251     <body>
252    
253     <p>
254 swift 1.60 If you have a static IP then you will need a few more details than if
255 swift 1.61 you have a dynamic IP. For static users, you will need your IP,
256 vapier 1.1 gateway, and DNS servers.
257     </p>
258    
259     <pre caption="Setting up eth1">
260     <comment>Dynamic IP Users:</comment>
261     # <i>emerge dhcpcd</i>
262     # <i>nano /etc/conf.d/net</i>
263 neysx 1.23 <comment>You'll need an entry like so:</comment>
264 vapier 1.25 config_eth1=( "dhcp" )
265 vapier 1.1
266     <comment>Static IP Users:</comment>
267     # <i>nano /etc/conf.d/net</i>
268 neysx 1.23 <comment>You'll need entries like so:</comment>
269 vapier 1.43 config_eth1=( "66.92.78.102 broadcast 66.92.78.255 netmask 255.255.255.0" )
270 neysx 1.23 routes_eth1=( "default gw 66.92.78.1" )
271 vapier 1.1 # <i>nano /etc/resolv.conf</i>
272 neysx 1.23 <comment>Add one line per DNS server:</comment>
273     nameserver 123.123.123.123
274 vapier 1.1
275     <comment>Dynamic and Static Setup:</comment>
276 vapier 1.30 # <i>ln -s net.lo /etc/init.d/net.eth1</i>
277 vapier 1.1 # <i>rc-update add net.eth1 default</i>
278     # <i>/etc/init.d/net.eth1 start</i>
279     </pre>
280    
281     <p>
282     You should be all set to go now.
283     </p>
284    
285     </body>
286     </section>
287     </chapter>
288    
289     <chapter>
290     <title>Hug the LAN (bring along some friends)</title>
291     <section>
292     <body>
293    
294     <p>
295     This step is a breeze compared to the previous one.
296     </p>
297    
298     <pre caption="Setting up eth0">
299     # <i>nano /etc/conf.d/net</i>
300 neysx 1.23 <comment>Add a line like the following:</comment>
301 vapier 1.43 config_eth0=( "192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0" )
302 vapier 1.1 # <i>rc-update add net.eth0 default</i>
303     # <i>/etc/init.d/net.eth0 start</i>
304     </pre>
305    
306     </body>
307     </section>
308     </chapter>
309    
310     <chapter>
311     <title>LAN Services (because we're nice people)</title>
312    
313     <section>
314     <title>DHCP Server</title>
315     <body>
316 neysx 1.23
317 vapier 1.1 <p>
318 neysx 1.23 I bet it'd be nice if everyone else in your house could just plug their
319 swift 1.61 computers into the network and things would just work. No need to remember
320 neysx 1.23 mind-numbing details or make them stare at confusing configuration screens!
321 swift 1.61 Life would be grand eh? Introducing the Dynamic Host Configuration Protocol
322 neysx 1.23 (DHCP) and why you should care.
323 vapier 1.1 </p>
324    
325 vapier 1.2 <p>
326 swift 1.61 DHCP is exactly what its name implies. It's a protocol that allows you
327     to dynamically configure other hosts automatically. You run a DHCP server on
328 vapier 1.33 the router, give it all the information about your network (valid IPs,
329 neysx 1.23 DNS servers, gateways, etc...), and then when the other hosts start up, they
330 swift 1.61 run a DHCP client to automatically configure themselves. No fuss, no muss!
331 neysx 1.23 For more information about DHCP, you can always visit <uri
332     link="http://en.wikipedia.org/wiki/DHCP">Wikipedia</uri>.
333 vapier 1.2 </p>
334    
335 vapier 1.33 <p>
336     We'll use a package called dnsmasq which provides both DHCP and DNS services.
337 swift 1.61 For now lets just focus on the DHCP aspect. Note that if you want to run a
338 vapier 1.33 different DHCP server, you can find another example in the Fun Things chapter.
339 swift 1.60 Also, if you wish to tinker with the DHCP server settings, just read the
340 swift 1.61 comments in <path>/etc/dnsmasq.conf</path>. All the defaults should work fine
341 vapier 1.33 though.
342     </p>
343    
344     <pre caption="Setting up a DHCP server">
345     # <i>emerge dnsmasq</i>
346     # <i>nano /etc/dnsmasq.conf</i>
347 vapier 1.43 <comment>Add this line to enable dhcp:</comment>
348 vapier 1.33 dhcp-range=192.168.0.100,192.168.0.250,72h
349 vapier 1.43 <comment>Restrict dnsmasq to just the LAN interface</comment>
350     interface=eth0
351 vapier 1.33
352     # <i>rc-update add dnsmasq default</i>
353     # <i>/etc/init.d/dnsmasq start</i>
354 vapier 1.1 </pre>
355    
356     <p>
357 swift 1.61 Now your little router is a bona-fide DHCP server! Plugin those computers and
358     watch them work! With Windows systems you should go into the TCP/IP Properties
359 neysx 1.23 and select the 'Obtain an IP address automatically' and 'Obtain DNS server
360 swift 1.61 address automatically' options. Sometimes the changes aren't instantaneous, so
361 vapier 1.31 you may have to open a command prompt and run <c>ipconfig /release</c> and
362 swift 1.61 <c>ipconfig /renew</c>. But enough about Windows, let's get back to our
363 neysx 1.23 favorite penguin.
364 vapier 1.1 </p>
365 neysx 1.23
366 vapier 1.1 </body>
367     </section>
368    
369     <section>
370     <title>DNS Server</title>
371     <body>
372 neysx 1.23
373 vapier 1.2 <p>
374 neysx 1.23 When people want to visit a place on the internet, they remember names, not a
375 swift 1.61 string of funky numbers. After all, what's easier to remember, ebay.com or
376     66.135.192.87? This is where the DNS steps in. DNS servers run all over the
377 neysx 1.23 internet, and whenever someone wants to visit 'ebay.com', these servers turn
378     'ebay.com' (what we understand) into '66.135.192.87' (what our computers
379 swift 1.61 understand). For more information about DNS, you can always visit <uri
380 neysx 1.23 link="http://en.wikipedia.org/wiki/DNS">Wikipedia</uri>.
381 vapier 1.2 </p>
382 vapier 1.1
383     <p>
384 vapier 1.33 Since we're using dnsmasq for our DHCP server, and it includes a DNS server,
385 swift 1.61 you've got nothing left to do here! Your little router is already providing
386     DNS to its DHCP clients. Bet you wish everything was this easy ;).
387 vapier 1.1 </p>
388    
389     <p>
390 swift 1.60 You're welcome to choose other DNS servers if you're more comfortable with
391     them, but the reason dnsmasq is great is because it was designed to do exactly
392 swift 1.61 what we want and nothing more. It's a little DNS caching/forwarding server for
393     local networks. We're not looking to provide DNS for our own domain here, just
394 vapier 1.33 offer simple DNS services to everyone else on our LAN.
395 vapier 1.1 </p>
396    
397     </body>
398     </section>
399    
400     <section>
401 vapier 1.4 <title>NAT (a.k.a. IP-masquerading)</title>
402 vapier 1.1 <body>
403    
404     <p>
405 neysx 1.23 At this point, people on your network can talk to each other and they can look
406     up hostnames via DNS, but they still can't actually connect to the internet.
407     While you may think that's great (more bandwidth for you!), I bet they're not
408     too happy just yet.
409 vapier 1.1 </p>
410    
411 vapier 1.2 <p>
412 swift 1.61 This is where Network Address Translation (NAT) steps in. NAT is a way of
413 swift 1.60 connecting multiple computers in a private LAN to the internet when you have a
414 swift 1.61 smaller number of public IP addresses available to you. Typically you are given
415 vapier 1.33 1 IP by your ISP, but you want to let your whole house connect to the internet.
416 swift 1.61 NAT is the magic that makes this possible. For more information about NAT, you
417 vapier 1.33 can always visit <uri link="http://en.wikipedia.org/wiki/NAT">Wikipedia</uri>.
418 vapier 1.2 </p>
419    
420     <note>
421 swift 1.61 Before we get started, make sure you have iptables on your system. Although it
422     is automatically installed on most systems, you may not have it. If you don't,
423 neysx 1.23 just run <c>emerge iptables</c>.
424 vapier 1.2 </note>
425    
426 vapier 1.1 <pre caption="Setting up iptables">
427     <comment>First we flush our current rules</comment>
428     # <i>iptables -F</i>
429     # <i>iptables -t nat -F</i>
430    
431 vapier 1.33 <comment>Setup default policies to handle unmatched traffic</comment>
432 vapier 1.32 # <i>iptables -P INPUT ACCEPT</i>
433     # <i>iptables -P OUTPUT ACCEPT</i>
434     # <i>iptables -P FORWARD DROP</i>
435    
436 vapier 1.30 <comment>Copy and paste these examples ...</comment>
437     # <i>export LAN=eth0</i>
438     # <i>export WAN=eth1</i>
439    
440 vapier 1.1 <comment>Then we lock our services so they only work from the LAN</comment>
441 vapier 1.30 # <i>iptables -I INPUT 1 -i ${LAN} -j ACCEPT</i>
442 vapier 1.1 # <i>iptables -I INPUT 1 -i lo -j ACCEPT</i>
443 vapier 1.30 # <i>iptables -A INPUT -p UDP --dport bootps -i ! ${LAN} -j REJECT</i>
444     # <i>iptables -A INPUT -p UDP --dport domain -i ! ${LAN} -j REJECT</i>
445 vapier 1.1
446 vapier 1.21 <comment>(Optional) Allow access to our ssh server from the WAN</comment>
447 vapier 1.30 # <i>iptables -A INPUT -p TCP --dport ssh -i ${WAN} -j ACCEPT</i>
448 vapier 1.21
449 vapier 1.1 <comment>Drop TCP / UDP packets to privileged ports</comment>
450 vapier 1.30 # <i>iptables -A INPUT -p TCP -i ! ${LAN} -d 0/0 --dport 0:1023 -j DROP</i>
451     # <i>iptables -A INPUT -p UDP -i ! ${LAN} -d 0/0 --dport 0:1023 -j DROP</i>
452 vapier 1.1
453     <comment>Finally we add the rules for NAT</comment>
454 vapier 1.30 # <i>iptables -I FORWARD -i ${LAN} -d 192.168.0.0/255.255.0.0 -j DROP</i>
455     # <i>iptables -A FORWARD -i ${LAN} -s 192.168.0.0/255.255.0.0 -j ACCEPT</i>
456     # <i>iptables -A FORWARD -i ${WAN} -d 192.168.0.0/255.255.0.0 -j ACCEPT</i>
457     # <i>iptables -t nat -A POSTROUTING -o ${WAN} -j MASQUERADE</i>
458 vapier 1.1 <comment>Tell the kernel that ip forwarding is OK</comment>
459     # <i>echo 1 > /proc/sys/net/ipv4/ip_forward</i>
460     # <i>for f in /proc/sys/net/ipv4/conf/*/rp_filter ; do echo 1 > $f ; done</i>
461    
462     <comment>This is so when we boot we don't have to run the rules by hand</comment>
463     # <i>/etc/init.d/iptables save</i>
464     # <i>rc-update add iptables default</i>
465 vapier 1.14 # <i>nano /etc/sysctl.conf</i>
466 vapier 1.50 <comment>Add/Uncomment the following lines:</comment>
467 vapier 1.14 net.ipv4.ip_forward = 1
468 vapier 1.50 net.ipv4.conf.default.rp_filter = 1
469    
470     <comment>If you have a dynamic internet address you probably want to enable this:</comment>
471     net.ipv4.ip_dynaddr = 1
472 vapier 1.1 </pre>
473    
474     <p>
475 neysx 1.23 Once you've typed out all of that, the rest of your network should now be able
476 swift 1.60 to use the internet as if they were directly connected themselves.
477 vapier 1.1 </p>
478    
479 vapier 1.50 <p>
480     The ip_dynaddr option is useful for dial on demand systems or when your ISP
481 swift 1.61 gives out dynamic addresses. This works around the problem where a connection
482     is attempted before the internet interface is fully setup. Really this just
483 vapier 1.50 provides for a smoother network experience for users behind your router.
484     </p>
485    
486 vapier 1.3 </body>
487     </section>
488     </chapter>
489    
490     <chapter>
491     <title>Fun Things (for a rainy day)</title>
492    
493     <section>
494     <title>Intro</title>
495     <body>
496 neysx 1.23
497 vapier 1.1 <p>
498 swift 1.61 Believe it or not, you're done :). From here on out, I'll cover a bunch of
499     common topics that may interest you. Everything in this chapter is completely
500 neysx 1.23 optional.
501 vapier 1.1 </p>
502 neysx 1.23
503 vapier 1.3 </body>
504     </section>
505 vapier 1.1
506 vapier 1.3 <section>
507     <title>Port Forwarding</title>
508     <body>
509 neysx 1.23
510 vapier 1.3 <p>
511 neysx 1.23 Sometimes you would like to be able to host services on a computer behind the
512 swift 1.61 router, or just to make your life easier when connecting remotely. Perhaps you
513 neysx 1.23 want to run a FTP, HTTP, SSH, or VNC server on one or more machines behind your
514 swift 1.61 router and be able to connect to them all. The only caveat is that you can
515     only have one service/machine combo per port. For example, there is no
516 neysx 1.23 practical way to setup three FTP servers behind your router and then try to
517     connect to them all through port 21; only one can be on port 21 while the
518     others would have to be on say port 123 and port 567.
519 vapier 1.3 </p>
520    
521     <p>
522 neysx 1.23 All the port forwarding rules are of the form <c>iptables -t nat -A PREROUTING
523 vapier 1.30 [-p protocol] --dport [external port on router] -i ${WAN} -j DNAT --to [ip/port
524 swift 1.61 to forward to]</c>. Unfortunately, iptables does not accept hostnames when port
525     forwarding. If you are forwarding an external port to the same port on the
526     internal machine, you can omit the destination port. See the iptables(8) man
527 vapier 1.33 page for more information.
528 vapier 1.3 </p>
529    
530 swift 1.28 <pre caption="Running the iptables commands">
531 vapier 1.30 <comment>Copy and paste these examples ...</comment>
532     # <i>export LAN=eth0</i>
533     # <i>export WAN=eth1</i>
534    
535 vapier 1.3 <comment>Forward port 2 to ssh on an internal host</comment>
536 vapier 1.30 # <i>iptables -t nat -A PREROUTING -p tcp --dport 2 -i ${WAN} -j DNAT --to 192.168.0.2:22</i>
537 vapier 1.3
538     <comment>FTP forwarding to an internal host</comment>
539 vapier 1.30 # <i>iptables -t nat -A PREROUTING -p tcp --dport 21 -i ${WAN} -j DNAT --to 192.168.0.56</i>
540 vapier 1.3
541     <comment>HTTP forwarding to an internal host</comment>
542 vapier 1.30 # <i>iptables -t nat -A PREROUTING -p tcp --dport 80 -i ${WAN} -j DNAT --to 192.168.0.56</i>
543 vapier 1.3
544     <comment>VNC forwarding for internal hosts</comment>
545 vapier 1.30 # <i>iptables -t nat -I PREROUTING -p tcp --dport 5900 -i ${WAN} -j DNAT --to 192.168.0.2</i>
546     # <i>iptables -t nat -I PREROUTING -p tcp --dport 5901 -i ${WAN} -j DNAT --to 192.168.0.3:5900</i>
547 vapier 1.3 <comment>If you want to VNC in to 192.168.0.3, then just add ':1' to the router's hostname</comment>
548    
549 vapier 1.55 <comment>SAMBA forwarding to an internal host (excess ports to cover Windows)</comment>
550     # <i>iptables -t nat -I PREROUTING -p tcp --dport 135 -i ${WAN} -j DNAT --to 192.168.0.2</i>
551     # <i>iptables -t nat -I PREROUTING -p tcp --dport 139 -i ${WAN} -j DNAT --to 192.168.0.2</i>
552     # <i>iptables -t nat -I PREROUTING -p tcp --dport 445 -i ${WAN} -j DNAT --to 192.168.0.2</i>
553     # <i>iptables -t nat -I PREROUTING -p udp --dport 137:138 -i ${WAN} -j DNAT --to 192.168.0.2</i>
554     # <i>iptables -t nat -I PREROUTING -p udp --dport 445 -i ${WAN} -j DNAT --to 192.168.0.2</i>
555    
556 vapier 1.3 <comment>Bittorrent forwarding</comment>
557 vapier 1.30 # <i>iptables -t nat -A PREROUTING -p tcp --dport 6881:6889 -i ${WAN} -j DNAT --to 192.168.0.2</i>
558 vapier 1.15
559 vapier 1.33 <comment>eDonkey/eMule forwarding</comment>
560     # <i>iptables -t nat -A PREROUTING -p tcp --dport 4662 -i ${WAN} -j DNAT --to 192.168.0.55</i>
561    
562 vapier 1.15 <comment>Game Cube Warp Pipe support</comment>
563 vapier 1.30 # <i>iptables -t nat -A PREROUTING -p udp --dport 4000 -i ${WAN} -j DNAT --to 192.168.0.56</i>
564 vapier 1.15
565 vapier 1.33 <comment>Playstation 2 Online support</comment>
566 vapier 1.30 # <i>iptables -t nat -A PREROUTING -p tcp --dport 10070:10080 -i ${WAN} -j DNAT --to 192.168.0.11</i>
567     # <i>iptables -t nat -A PREROUTING -p udp --dport 10070:10080 -i ${WAN} -j DNAT --to 192.168.0.11</i>
568 vapier 1.34
569     <comment>Xbox Live</comment>
570     # <i>iptables -t nat -A PREROUTING -p tcp --dport 3074 -i ${WAN} -j DNAT --to 192.168.0.69</i>
571     # <i>iptables -t nat -A PREROUTING -p udp --dport 3074 -i ${WAN} -j DNAT --to 192.168.0.69</i>
572     # <i>iptables -t nat -A PREROUTING -p udp --dport 88 -i ${WAN} -j DNAT --to 192.168.0.69</i>
573 vapier 1.3 </pre>
574    
575     <note>
576 neysx 1.37 If you have other common / cool examples, please <mail
577     link="vapier@gentoo.org">e-mail me</mail>.
578 vapier 1.3 </note>
579 neysx 1.23
580 vapier 1.3 </body>
581     </section>
582    
583     <section>
584     <title>Identd (for IRC)</title>
585     <body>
586 neysx 1.23
587 vapier 1.3 <p>
588 swift 1.61 Internet Relay Chat utilizes the ident service pretty heavily. Now that the
589 neysx 1.23 IRC clients are behind the router, we need a way to host ident for both the
590 swift 1.61 router and the clients. One such server has been created called
591 neysx 1.23 <c>midentd</c>.
592 vapier 1.3 </p>
593    
594     <pre caption="Setting up ident">
595     # <i>emerge midentd</i>
596     # <i>rc-update add midentd default</i>
597     # <i>/etc/init.d/midentd start</i>
598     </pre>
599    
600     <p>
601 swift 1.61 There are a few other ident servers in portage. Depending on your needs, I
602 neysx 1.23 would recommend checking out <c>oidentd</c> and <c>fakeidentd</c>.
603 vapier 1.3 </p>
604 neysx 1.23
605 vapier 1.3 </body>
606     </section>
607    
608 vapier 1.5 <!--
609     <section>
610     <title>Traffic Shaping</title>
611     <body>
612     <p>
613 swift 1.60 This is an attempt to simply and Gentooify the <uri link="http://www.tldp.org/HOWTO/ADSL-Bandwidth-Management-HOWTO/">ADSL Bandwidth Management HOWTO</uri>
614 swift 1.61 found over at the TLDP. Feel free to refer to the original document
615 vapier 1.5 for more details.
616     </p>
617    
618     <p>
619 swift 1.60 Here we will be setting up what some people refer to as a "Packet Shaper",
620     <uri link="http://en.wikipedia.org/wiki/Traffic_shaping">"Traffic Shaping"</uri>,
621     or <uri link="http://en.wikipedia.org/wiki/QoS">"Quality of Service"</uri>.
622     Simply put, we want to setup rules on our router that will slow down
623     certain activities (like sending large e-mails or downloading from P2P
624     networks) while keeping other activities (like browsing the web or playing
625 swift 1.61 online video games) reasonably fast. A 30 second difference in a video
626 swift 1.60 game is a lot worse than a 30 second difference in downloading large
627 vapier 1.5 files :).
628     </p>
629    
630     <p>
631 swift 1.60 The first thing is to make sure your kernel has all the features added to
632 swift 1.61 it. See the chapter on <uri link="#doc_chap2">Kernel setup</uri> for more
633     information. Next, you will need to <c>emerge iptables iputils</c> so that
634 swift 1.60 you will have access to the <c>iptables</c>, <c>ip</c>, and <c>tc</c>
635 vapier 1.5 commands.
636     </p>
637    
638     <p>
639 swift 1.61 Before we jump into the commands, let's cover a little of the theory. The
640 swift 1.60 way this whole system works is to classify common network streams and then
641 swift 1.61 to prioritize them. You use iptables to classify network streams, iputils
642 swift 1.60 to define the different priority levels, and the kernel to adjust speeds.
643     Just remember that although you can control outbound traffic pretty tightly
644     (from the LAN to the WAN), your ability to control inbound traffic (from
645 swift 1.61 the WAN to the LAN) is somewhat limited. Just remember that the following
646 swift 1.60 examples are to get your feet wet; if you want more then I'd suggest
647 swift 1.61 reading up on the subject. In this example, we will be using the
648 swift 1.60 <uri link="http://luxik.cdi.cz/~devik/qos/htb/">Hierarchical Token Buckets (HTB)</uri>
649 swift 1.61 packet scheduling algorithm. Still with me? Great, let's start shaping :).
650 vapier 1.5 </p>
651    
652     <pre caption="Setup">
653     DEV=eth1 <comment>NIC connected to WAN</comment>
654     RATE_OUT=100 <comment>Available outbound bandwidth (in kilobits [kb])</comment>
655     RATE_IN=1400 <comment>Available inbound bandwidth (in kb)</comment>
656    
657 swift 1.61 <comment>Here we initialize the priority system. The 45 is used to set the default classification level.</comment>
658 vapier 1.5 ip link set dev ${DEV} qlen 30
659     tc qdisc add dev ${DEV} root handle 1: htb default 45
660     tc class add dev ${DEV} parent 1: classid 1:1 htb rate ${RATE_OUT}kbit
661     </pre>
662    
663     <p>
664 swift 1.60 Here we initialized the system which will be used to prioritize all of
665 swift 1.61 our network traffic. We created our queue, told it to use the HTB
666     algorithm, and set the default classification level to '45'. The
667 swift 1.60 default is completely arbitrary, as are the levels we choose from
668 swift 1.61 here on out. The only thing that matters is how the levels compare
669 swift 1.60 relatively; a level '10' packet will be given preference over a
670 swift 1.61 level '45' packet. Let's move on to declaring different levels.
671 vapier 1.5 </p>
672    
673     <pre caption="Declaring levels">
674     tc class add dev $DEV parent 1:1 classid 1:10 htb rate $rkbit ceil $tkbit prio $p
675     tc qdisc add dev $DEV parent 1:10 handle 10: sfq
676     </pre>
677     </body>
678     </section>
679     -->
680    
681 vapier 1.3 <section>
682 vapier 1.9 <title>Time Server</title>
683     <body>
684 neysx 1.23
685 vapier 1.9 <p>
686 vapier 1.24 Keeping your system time correct is essential in maintaining a healthy system.
687 neysx 1.23 One of the most common ways of accomplishing this is with the Network Time
688     Protocol (NTP) and the ntp package (which provides implementations for both
689     server and client).
690 vapier 1.9 </p>
691    
692     <p>
693 swift 1.61 Many people run ntp clients on their computers. Obviously, the more clients in
694     the world, the larger the load the ntp servers need to shoulder. In
695 neysx 1.23 environments like home networks though, we can help keep the load down on
696 swift 1.61 public servers while still providing the proper time to all our computers. As
697 neysx 1.23 an added bonus, our private updates will be a lot faster for the clients too!
698     All we have to do is run a ntp server on our router that synchronizes itself
699     with the public internet servers while providing the time to the rest of the
700 swift 1.61 computers in the network. To get started, simply <c>emerge ntp</c> on the
701 vapier 1.9 router.
702     </p>
703    
704     <pre caption="Setting up the NTP server">
705     # <i>nano /etc/conf.d/ntp-client</i>
706     <comment>Customize if you wish but the defaults should be fine</comment>
707     # <i>rc-update add ntp-client default</i>
708    
709     # <i>nano /etc/ntp.conf</i>
710 neysx 1.23 <comment>Add the follwing lines:</comment>
711 vapier 1.9 restrict default ignore
712     restrict 192.168.0.0 mask 255.255.255.0 notrust nomodify notrap
713 neysx 1.23 <comment>These will allow only ntp clients with an IP
714     address in the 192.168.0.xxx range to use your ntp server</comment>
715 vapier 1.9 # <i>nano /etc/conf.d/ntpd</i>
716     <comment>Customize if you wish but the defaults should be fine</comment>
717 vapier 1.17 # <i>rc-update add ntpd default</i>
718 vapier 1.9
719     # <i>/etc/init.d/ntp-client start</i>
720     # <i>/etc/init.d/ntpd start</i>
721     </pre>
722    
723 vapier 1.22 <note>
724 neysx 1.23 You should make sure that you allow inbound and outbound communication on the
725 swift 1.61 ntp port (123/udp) when setting up the server. The client just needs outbound
726 neysx 1.23 access on port 123 over udp.
727 vapier 1.22 </note>
728    
729 vapier 1.9 <p>
730 swift 1.61 Now, on your clients, have them <c>emerge ntp</c> also. However, we will just
731 neysx 1.23 run the ntp client so setup is a lot simpler.
732 vapier 1.9 </p>
733    
734     <pre caption="Setting up a NTP client">
735     # <i>nano /etc/conf.d/ntp-client</i>
736     <comment>Change the 'pool.ntp.org' server in the NTPCLIENT_OPTS variable to '192.168.0.1'</comment>
737     # <i>rc-update add ntp-client default</i>
738     # <i>/etc/init.d/ntp-client start</i>
739     </pre>
740 neysx 1.23
741 vapier 1.9 </body>
742     </section>
743    
744     <section>
745 vapier 1.29 <title>Rsync Server</title>
746     <body>
747    
748     <p>
749 swift 1.60 For those who run multiple Gentoo boxes on the same lan, you often want to
750     keep from having every machine running <c>emerge sync</c> with remote
751 swift 1.61 servers. By setting up a local rsync, you save on both your bandwidth and
752     the Gentoo rsync servers' bandwidth. It's pretty simple to do.
753 vapier 1.29 </p>
754 neysx 1.45
755 vapier 1.29 <note>
756 neysx 1.45 For a much more in-depth rsync guide, please see the official <uri
757     link="/doc/en/rsync.xml#local">rsync guide</uri>.
758 vapier 1.29 </note>
759    
760     <p>
761 swift 1.61 Since every Gentoo machine requires rsync, theres no need to emerge it. Edit
762 swift 1.60 the default <path>/etc/rsyncd.conf</path> config file, uncomment the
763     <c>[gentoo-portage]</c> section, and make sure you add an <c>address</c>
764 swift 1.61 option. All the other defaults should be fine.
765 vapier 1.29 </p>
766    
767     <pre caption="Rsync server config">
768     pid file = /var/run/rsyncd.pid
769     use chroot = yes
770     read only = yes
771     address = 192.168.0.1
772    
773     [gentoo-portage]
774 swift 1.61 path = /mnt/space/portage
775     comment = Gentoo Linux Portage tree
776     exclude = /distfiles /packages
777 vapier 1.29 </pre>
778    
779     <p>
780     Then you need to start the service (again, the defaults are OK).
781     </p>
782    
783     <pre caption="Starting the rsync server">
784     # <i>/etc/init.d/rsyncd start</i>
785     # <i>rc-update add rsyncd default</i>
786     </pre>
787    
788     <p>
789     Only thing left is to set tell your clients to sync against the router.
790     </p>
791    
792     <pre caption="Client SYNC settings in make.conf">
793     SYNC="rsync://192.168.0.1/gentoo-portage"
794     </pre>
795    
796     </body>
797     </section>
798    
799     <section>
800 vapier 1.3 <title>Mail Server</title>
801     <body>
802 neysx 1.23
803 vapier 1.3 <p>
804 neysx 1.23 Sometimes it's nice to run your own Simple Mail Transfer Protocol (SMTP) server
805 swift 1.61 on the router. You may have your own reason for wanting to do so, but I run it
806 neysx 1.23 so that the users see mail as being sent instantly and the work of
807 swift 1.61 retrying/routing is left up to the mail server. Some ISPs also don't allow for
808 neysx 1.23 mail relaying for accounts that aren't part of their network (like Verizon).
809     Also, you can easily throttle the delivery of mail so that large attachments
810     won't seriously lag your connection for half an hour.
811 vapier 1.4 </p>
812    
813     <pre caption="Setting up SMTP">
814 nightmorph 1.56 # <i>emerge netqmail</i>
815 vapier 1.4 <comment>make sure the output of `hostname` is correct</comment>
816 nightmorph 1.56 # <i>emerge --config netqmail</i>
817 vapier 1.30 # <i>iptables -I INPUT -p tcp --dport smtp -i ! ${LAN} -j REJECT</i>
818 vapier 1.4 # <i>ln -s /var/qmail/supervise/qmail-send /service/qmail-send</i>
819 vapier 1.10 # <i>ln -s /var/qmail/supervise/qmail-smtpd /service/qmail-smtpd</i>
820 vapier 1.4 # <i>cd /etc/tcprules.d</i>
821     # <i>nano tcp.qmail-smtp</i>
822 vapier 1.57 <!--
823 vapier 1.13 # <i>cd /etc</i>
824     # <i>nano tcp.smtp</i>
825 vapier 1.57 -->
826 neysx 1.23 <comment>Add an entry like so to the allow section:</comment>
827     192.168.0.:allow,RELAYCLIENT=""
828 vapier 1.13 <!--
829 vapier 1.4 # <i>tcprules tcp.qmail-qmtp.cdb rules.tmp &lt; tcp.qmail-smtp</i>
830 vapier 1.57 # <i>tcprules tcp.smtp.cdb rules.tmp &lt; tcp.smtp</i>
831 vapier 1.13 -->
832 vapier 1.57 # <i>make</i>
833 vapier 1.4 # <i>rc-update add svscan default</i>
834     # <i>/etc/init.d/svscan start</i>
835     </pre>
836    
837     <p>
838 swift 1.61 I'm a huge fan of qmail, but you're free to use a different mta :). When you
839 neysx 1.23 setup e-mail on the hosts in your network, tell them that their SMTP server is
840 swift 1.61 192.168.0.1 and everything should be peachy. You might want to visit the <uri
841 nightmorph 1.56 link="http://netqmail.org/">netqmail homepage</uri> for more documentation.
842 vapier 1.3 </p>
843 neysx 1.23
844 vapier 1.3 </body>
845     </section>
846    
847 vapier 1.4 <!--
848 vapier 1.3 <section>
849 vapier 1.4 <title>E-mail Virus Scanning</title>
850 vapier 1.3 <body>
851     <p>
852 swift 1.60 If you'd like to provide e-mail virus scanning for your users, but
853     don't want to have to install a virus scanner on every single machine,
854     then <c>pop3vscan</c> may just be the thing for you; a transparent
855 vapier 1.4 Post Office Protocol (POP) scanner.
856 vapier 1.3 </p>
857 vapier 1.4
858     <pre caption="Setting up pop3vscan">
859     TODO
860     </pre>
861    
862 vapier 1.3 </body>
863     </section>
864 vapier 1.4 -->
865 vapier 1.3
866 vapier 1.33 <section>
867     <title>Full DHCP Server</title>
868     <body>
869    
870     <p>
871 swift 1.61 Earlier we used dnsmasq to provide DHCP service to all our clients. For most
872     people with a simple small LAN, this is perfect. But you may need something
873     with more features. Thus we turn to a full-featured DHCP server as provided
874 vapier 1.33 by the <uri link="http://www.isc.org/products/DHCP">ISC</uri> folks.
875     </p>
876    
877     <pre caption="Setting up dhcpd">
878     # <i>emerge dhcp</i>
879     # <i>nano /etc/dhcp/dhcpd.conf</i>
880     <comment>(Here is a sample configuration file:)</comment>
881     authoritative;
882     ddns-update-style interim;
883     subnet 192.168.0.0 netmask 255.255.255.0 {
884 swift 1.61 range 192.168.0.100 192.168.0.250;
885     default-lease-time 259200;
886     max-lease-time 518400;
887     option subnet-mask 255.255.255.0;
888     option broadcast-address 192.168.0.255;
889     option routers 192.168.0.1;
890     option domain-name-servers 192.168.0.1;
891 vapier 1.33 }
892 vapier 1.44 # <i>nano /etc/conf.d/dhcpd</i>
893 vapier 1.33 <comment>(Set IFACE="eth0")</comment>
894 vapier 1.44 # <i>rc-update add dhcpd default</i>
895     # <i>/etc/init.d/dhcpd start</i>
896 vapier 1.33 </pre>
897    
898     <p>
899 swift 1.60 This is the minimal setup required to replace the dnsmasq DHCP functionality
900 swift 1.61 that we used earlier. Speaking of which, you did remember to disable the DHCP
901     features in dnsmasq didn't you? If not, you should do so now (just comment
902 vapier 1.33 out the <c>dhcp-range</c> setting in <path>/etc/dnsmasq.conf</path> and restart
903     the service).
904     </p>
905    
906     </body>
907     </section>
908    
909 vapier 1.38 <section>
910     <title>Connect Another LAN (or two or three or ...)</title>
911     <body>
912    
913     <p>
914 swift 1.61 Sometimes you have need of connecting the router to another LAN. Maybe you
915 swift 1.60 want to hook up a group of friends temporarily, or you're a neat freak and
916     want to section off different groups of computers, or you're just really
917 swift 1.61 really bored. Whatever the reasons, extending the router to other LAN
918     networks should be pretty straightforward. In the following examples, I will
919 swift 1.60 assume that this new network is connected via a third ethernet card, namely
920 vapier 1.38 <c>eth2</c>.
921     </p>
922    
923     <p>
924 swift 1.61 First you need to configure the interface. Just take the instructions in the
925 swift 1.60 <uri link="#doc_chap4_pre1">4.1 code listing</uri> and replace <c>eth0</c>
926 vapier 1.38 with <c>eth2</c> and <c>192.168.0</c> with <c>192.168.1</c>.
927     </p>
928    
929     <p>
930 swift 1.61 Then you need to tweak dnsmasq to service the new interface. Just edit the
931 swift 1.60 <path>/etc/conf.d/dnsmasq</path> file again and append <c>-i eth2</c> to
932 swift 1.61 DNSMASQ_OPTS; using -i multiple times is OK. Then edit
933 swift 1.60 <path>/etc/dnsmasq.conf</path> and add another line like the dhcp-range line
934     in the <uri link="#doc_chap5_pre1">5.1 code listing</uri>, replacing
935 swift 1.61 <c>192.168.0</c> with <c>192.168.1</c>. Having multiple dhcp-range lines is
936 vapier 1.38 OK too.
937     </p>
938    
939     <p>
940 swift 1.60 Finally, see the rules in the <uri link="#doc_chap5_pre2">5.2 code
941 swift 1.61 listing</uri> and duplicate the rules that have <c>-i ${LAN}</c> in them. You
942 vapier 1.38 may want to create another variable, say <c>LAN2</c>, to make things easier.
943     </p>
944    
945     </body>
946     </section>
947    
948 vapier 1.4 </chapter>
949    
950     <chapter>
951 vapier 1.30 <title>Troubleshooting</title>
952 vapier 1.27
953     <section>
954     <title>Useful Tools</title>
955     <body>
956    
957     <p>
958 swift 1.60 If you're having trouble getting your computers to communicate, you may way to
959     try out the following tools (they can all be found in the <c>net-analyzer</c>
960 vapier 1.27 portage category):
961     </p>
962    
963     <table>
964     <tr>
965 swift 1.61 <th>Utility</th>
966     <th>Description</th>
967 vapier 1.27 </tr>
968     <tr>
969 swift 1.61 <ti>wireshark</ti>
970     <ti>GUI tool to view all raw network data according to filters</ti>
971 vapier 1.27 </tr>
972     <tr>
973 swift 1.61 <ti>tcpdump</ti>
974     <ti>Console tool to dump all raw network data according to filters</ti>
975 vapier 1.27 </tr>
976     <tr>
977 swift 1.61 <ti>iptraf</ti>
978     <ti>ncurses based IP LAN monitor</ti>
979 vapier 1.27 </tr>
980     <tr>
981 swift 1.61 <ti>ettercap</ti>
982     <ti>ncurses based network monitor/control</ti>
983 vapier 1.27 </tr>
984     </table>
985    
986     </body>
987     </section>
988    
989     <section>
990 vapier 1.31 <title>DHCP Fails To Start</title>
991     <body>
992    
993     <p>
994 swift 1.60 When starting the dhcp init.d script for the first time, it may fail to load
995 vapier 1.31 but neglect to give you any useful info.
996     </p>
997    
998     <pre caption="DHCP Failing Example">
999     # <i>/etc/init.d/dhcp start</i>
1000 swift 1.61 * Setting ownership on dhcp.leases ... [ ok ]
1001     * Starting dhcpd ... [ !! ]
1002 vapier 1.31 </pre>
1003    
1004     <p>
1005 swift 1.61 The trick is to know where dhcpd is sending its output. Simply browse to
1006     <path>/var/log</path> and read the log files. Since the exact log file depends
1007 rane 1.46 on the package you are using as a syslog, try running <c>grep -Rl dhcpd
1008 swift 1.61 /var/log</c> to narrow down the possibilities. Chances are you made a typo in
1009     your config file. You could also try running <c>dhcpd -d -f</c> (short for
1010 rane 1.46 debug / foreground) and debug the error based upon the output.
1011 vapier 1.31 </p>
1012    
1013     </body>
1014     </section>
1015    
1016     <section>
1017 vapier 1.27 <title>Incorrect MTU Value</title>
1018     <body>
1019    
1020     <p>
1021 vapier 1.52 If you experience odd errors (such as not being able to access some webpages
1022 swift 1.61 while others load fine), you may be having Path MTU Discovery trouble. The
1023 vapier 1.52 quick way to test is to run this iptables command:
1024 vapier 1.27 </p>
1025    
1026     <pre caption="Circumvent MTU issues">
1027     # <i>iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu</i>
1028     </pre>
1029    
1030     <p>
1031 nightmorph 1.54 This will affect all new connections, so just refresh the website you're having
1032     problems with in order to test. In case it helps, the standard MTU value for
1033     100mbit ethernet connections is <c>1500</c>; this value also applies to PPPoA.
1034     For PPPoE connections it is <c>1492</c>. For more info, you should read Chapter
1035     15 of the <uri link="http://lartc.org/howto/">Linux Advanced Routing &amp;
1036 vapier 1.27 Traffic Control HOWTO</uri>.
1037     </p>
1038    
1039 vapier 1.62 <p>
1040     If that command does not work for you, you may want to try putting the rule
1041     into the mangle table. Simply add <c>-t mangle</c> to the command.
1042     </p>
1043    
1044 vapier 1.27 </body>
1045     </section>
1046    
1047 vapier 1.47 <section>
1048     <title>Unable to connect two machines directly</title>
1049     <body>
1050    
1051     <p>
1052 swift 1.60 If (for whatever reason) you want to connect two machines directly together
1053 jkt 1.48 without a hub or switch, a regular ethernet cable will likely not work, unless
1054     you have an Auto MDI/MDI-X (also known as "autosensing") capable network
1055 swift 1.61 adapter. You will need a different cable called a crossover cable. This <uri
1056 vapier 1.47 link="http://en.wikipedia.org/wiki/Ethernet_crossover_cable">Wikipedia</uri>
1057     page explains the low level details.
1058     </p>
1059    
1060     </body>
1061     </section>
1062    
1063 vapier 1.27 </chapter>
1064    
1065     <chapter>
1066 vapier 1.4 <title>Final Notes</title>
1067 vapier 1.3 <section>
1068     <body>
1069 neysx 1.23
1070 vapier 1.3 <p>
1071 neysx 1.23 I have no final notes other than if you experience any troubles with the guide,
1072     please contact <mail link="vapier@gentoo.org">me</mail> or file a bug with <uri
1073 swift 1.61 link="http://bugs.gentoo.org/">Gentoo's Bugtracking Website</uri>. If you have
1074 neysx 1.23 some interesting bits you think would enhance this guide, by all means send it
1075     my way for inclusion.
1076 vapier 1.3 </p>
1077 neysx 1.23
1078 vapier 1.1 </body>
1079     </section>
1080     </chapter>
1081     </guide>

  ViewVC Help
Powered by ViewVC 1.1.20