|
S generic valium tting up IP Aliasing on A Linux Machine Mini-HOWTOHarish Pillay h.pillay@ieee.org Joy Yokley - Converted document from generic valium HTML to DocBook v4.1 (SGML)2001-01-23Revision History Revi generic valium ion 1.2 2001-01-26 Revised by: JEY Revision 1.1 2001-01-24 R generic valium vised by: JEY Revision 1.0 1997-01-13 Revised by: HP This is a c generic valium okbook recipe on how to set up and run IP aliasing on a Linux boxand how to set up the machine to receive e-mail on th generic valium aliased IP addresses.-----------------------------------------------------------------------------Table of Contents1. generic valium My Setup2. Commands3. Troubleshooting: Questions and Answers 3.1. Question: How can I keep the settings through a r generic valium boot? 3.2. Question: How do I set up the IP aliased machine to receive e-mail on the various aliased IP addr generic valium sses (on a machine using sendmail)? 4. Acknowledgements---------------------------------------------------------- generic valium ------------------1. My Setup * IP Alias is standard in kernels 2.0.x and 2.2.x, and available as a compile-time o generic valium tion in 2.4.x (IP Alias has been deprecated in 2.4.x and replaced by a more powerful firewalling mechanism.) * generic valium P Alias compiled as a loadable module. You would have indicated in the "make config" command to make your kernel, t generic valium at you want the IP Masq to be compiled as a (M)odule. Check the Modules HOW-TO (if that exists) or check the inf generic valium in /usr/src/linux/Documentation/modules.txt. * I have to support 2 additional IPs over and above the IP already generic valium allocated to me. * A D-Link DE620 pocket adapter (not important, works with any Linux supported network adapte generic valium ). -----------------------------------------------------------------------------2. Commands 1. Load the IP Alias mod generic valium le (you can skip this step if you compiled the module into the kernel): /sbin/insmod /lib/modules/`uname -r`/ipv generic valium /ip_alias.o 2. Setup the loopback, eth0, and all the IP addresses beginning with the main IP addres generic valium for the eth0 interface: /sbin/ifconfig lo 127.0.0.1 /sbin/ifconfig eth0 u generic valium /sbin/ifconfig eth0 172.16.3.1 /s generic valium in/ifconfig eth0:0 172.16.3.10 /sbin/ifconfig eth0:1 172.16.3.100 generic valium 172.16.3.1 is the main IP address, while .10 and .100 are the aliases. The magic is the eth0:x w generic valium ere x=0,1,2,...n for the different IP addresses. The main IP address does not need to be aliased. 3. Setup the r generic valium utes. First route the loopback, then the net, and finally, the various IP addresses starting with the default (orig generic valium nally allocated) one: /sbin/route add -net 127.0.0.0 /sbin/route add -net generic valium 72.16.3.0 dev eth0 /sbin/route add -host 172.16.3.1 dev eth0 /s generic valium in/route add -host 172.16.3.10 dev eth0:0 /sbin/route add -host 172.16.3.100 dev eth0:1 generic valium /sbin/route add default gw 172.16.3.200 That's it. In the example IP generic valium address above, I am using the Private IP addresses (RFC1918) for illustrative purposes. Substitute them with your own generic valium fficial orprivate IP addresses.The example shows only 3 IP addresses. The max is defined to be 256 in /usr/include/lin generic valium x/net_alias.h. 256 IP addresses on ONE card is a lot :-)!Here's what my /sbin/ifconfig looks like:lo Link encap generic valium Local Loopback inet addr:127.0.0.1 Bcast:127.255.255.25 generic valium Mask:255.0.0.0 UP BROADCAST LOOPBACK RUNNING MTU:3584 Metric:1 generic valium RX packets:5088 errors:0 dropped:0 overruns:0 TX packets:5088 errors:0 generic valium ropped:0 overruns:0 generic valium eth0 Link encap:10Mbps Ethernet HWaddr 00:8E:B8:83:19:20 inet addr:172. generic valium 6.3.1 Bcast:172.16.3.255 Mask:255.255.255.0 UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 generic valium etric:1 RX packets:334036 errors:0 dropped:0 overruns:0 TX generic valium ackets:11605 errors:0 dropped:0 overruns:0 Interrupt:7 Base address:0x378 generic valium eth0:0 Li generic valium k encap:10Mbps Ethernet HWaddr 00:8E:B8:83:19:20 inet addr:172.16.3.10 Bcast generic valium 172.16.3.255 Mask:255.255.255.0 UP BROADCAST RUNNING MTU:1500 Metric:1 generic valium RX packets:0 errors:0 dropped:0 overruns:0 TX packets:0 erro generic valium s:0 dropped:0 overruns:0 generic valium eth0:1 Link encap:10Mbps Ethernet HWaddr 00:8E:B8:83:19:20 inet a generic valium dr:172.16.3.100 Bcast:172.16.3.255 Mask:255.255.255.0 UP BROADCAST RUNNING MTU:1500 Metric:1 generic valium RX packets:1 errors:0 dropped:0 overruns:0 generic valium TX packets:0 errors:0 dropped:0 overruns:0 And /proc/net/aliases:device family addr generic valium ss eth0:0 2 172.16.3.10 generic valium eth0:1 2 172.16.3.100 And /proc/net/alias_types:type name n_attach 2 ip 2 Of course, the stuff in /proc/net was created by the ifconfig command and notby hand!-----------------------------------------------------------------------------3. Troubleshooting: Questions and Answers3.1. Question: How can I keep the settings through a reboot?Answer: Whether you are using BSD-style or SysV-style (Redhat?? for example) init, you can always include it in /etc/rc.d/rc.local. Here's what I have onmy SysV init system (Redhat?? 3.0.3 and 4.0):My /etc/rc.d/rc.local: (edited to show the relevant portions)#setting up IP alias interfaces echo "Setting 172.16.
|