Article View: comp.os.linux.networking
Article #390Re: how to set up a 192.168.xxx.xxx network next to existing network
From: Jon Rook
Date: Wed, 29 May 2002 12:44
Date: Wed, 29 May 2002 12:44
96 lines
5378 bytes
5378 bytes
hugo wrote: > > Hi > > I received a useful reply on how to set up a 192.168.xxx.xxx network > next to my existing one, but I am still not quite sure on how to > implement the changes. Aor my gateway and router I am running linux 6.2 > (kernel 2.4.2-2) with iptables-1.2.1a-1 and iproute-2.2.4-10. I have > received instructions from Jerzy Jamrozy, and below are the answers he > gives and the further questions I have: > > Jerzy Jamrozy wrote: > > > > Hi, > > > > The thing is very simple.. do not try to complicate it too much :) > > 1) On your gateway you should have two interfaces: one with address in your > > old subnet, the other with address in your new address, e.g. 192.168.0.1 > > mask 255.255.0.0. > > Where do I add the information for the second interface? On my linux > machine, do I simply add another gateway entry in the > /etc/sysconfig/network file by adding a line: > > GATEWAY=192.168.0.1 > > > 2) define a NAT (masquarade) on the 192.168 network - you have to do that > > since 192.168 netwok can not be seen from the internet > > Can someone tell me where to add the requisite information under linux > to define a NAT? I am using IP tables and I have a firewall script. I > think I may have to put a line in my firewall script, something like: > > iptables -append FORWARD -i eth0 204.49.23.64/26 -dst 192.168.0.0/24 -j > MASQ > > Would this both forward as well as masquerade to 192.168.0.0/24? > > > 3) enable IP forwarding > > Hopefully the above line takes care of that? Can someone correct that > line if it is wrong? > > > 4) setup a separate DHCP on your gateway - just for 192.168 machines with > > def. gateway set to 192.168.0.1 > > Do I have to set up the DHCP on the gateway? I was hoping I could set it > up on one of my servers, then have make it so that the server has an IP > address on the old as well as on the new network. > > > 5) voila.. i think.. ;) > > > > J.J. > > If someone can help me with the details, that would be tremendously > appreciated. > > Thanks > > Hugo Hugo, 1)Re Interface setup: Not sure which distribution you are runing, but most of the more popular ones have a GUI tool that can be used to set up an interface. Do some snooping around in your system and you should be able to find it. 2) Re NAT: You are correct in that NAT/Masquerading is done in IPTables. You are also correct that it is done via the FORWARD chain. However, I think you have the direction wrong. You want to masquerade hosts on your 192.168.x.x net. Masquerading will give packets sent from one of these hosts a source IP address of the "other" interface. I.e. outgoing packets from your internal network will look to someone on the internet like they came from the gateway machine. I'm not an IPTables expert, but it looks to me like you are trying to masquerade packets destined for the 192.168 network. It should go the other way. 3) Re IP Forwarding: NAT is different than IP forwarding, so the above will not take care of it. When enabled, IP Forwarding allows your machine to act like a gateway. I.e. to pass packets from one network to another. Forwarding can be enabled by entering the line: echo 1 > /proc/sys/net/ipv4/ip_forward This will enable forwarding until the next reboot. If you always want your machine to be a gateway, put this command into a startup script so that the command is executed on every reboot. The file /etc/rc.d/rc.local is intended for "local" startup commands and so is a logical place to put this command. 4) Re DHCP: No, you don't have to run DHCP from the linux box. In fact, you don't even have to run DHCP at all. In that case you would have to give a fixed IP address to every host (interface) on the network. Good luck, Jon
Technical Details
Message-ID:
<3CF4CD27.C90E9590@latticesemi.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!ef33061f!not-for-mailReferences:
<3CF4400C.D16FE45C@fractalgraphics.com.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 105af6,5a9a9edbaac586f3 X-Google-Attributes: gid105af6,public X-Google-Thread: 10669a,5a9a9edbaac586f3 X-Google-Attributes: gid10669a,public X-Google-Thread: f4ee5,5a9a9edbaac586f3 X-Google-Attributes: gidf4ee5,public X-Google-Thread: 108a34,5a9a9edbaac586f3 X-Google-Attributes: gid108a34,public X-Google-ArrivalTime: 2002-05-29 05:44:42 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!ef33061f!not-for-mail Message-ID: <3CF4CD27.C90E9590@latticesemi.com> From: Jon Rook <jon.rook@latticesemi.com> X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.linux.networking,be.comp.networking,comp.os.ms-windows.networking.misc,microsoft.public.win98.networking Subject: Re: how to set up a 192.168.xxx.xxx network next to existing network References: <3CF4400C.D16FE45C@fractalgraphics.com.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 96 Date: Wed, 29 May 2002 12:44:39 GMT NNTP-Posting-Host: 63.214.198.102 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1022676279 63.214.198.102 (Wed, 29 May 2002 05:44:39 PDT) NNTP-Posting-Date: Wed, 29 May 2002 05:44:39 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net