Networking Forums

Networking Forums > Computer Networking > Linux Networking > linuxbox as router

Reply
Thread Tools Display Modes

linuxbox as router

 
 
xix xeaon
Guest
Posts: n/a

 
      01-05-2007, 05:57 PM
I think I've got most of this put together quite nicely but there is
one critical part I don't know what to do about, the networks can't
communicate with each other.

I have one normal pc with linux on (kubuntu 6.10, fresh install) and it
has one ethernet port on the motherboard (eth2) which is connected to a
cable modem that does not require any authentication. in this box I
have 2 pci ethernet cards, one is connected to a wireless access point
(eth0) that does not require any authentication and the other is
connected to a wired switch (eth1).

on eth2 I get a global ip (83.249.178.41/19), on eth0 I've set
192.168.1.1/24 and on eth1 I've set 192.168.2.1/24. I've installed
dhcp3-server and set it to listen on eth0 and eth1. I've created the
two subnets and all wireless gets 192.168.1.11-100/24 and all wired
gets 192.168.2.11-100/24 and the default gateways 192.168.1.1 and
192.168.2.1 respectively. everybody also gets the broadcast address
192.168.255.255 and the 2 dns servers from my isp as well as the 2 dns
servers of opendns.
all connected computers run windows xp home or pro.

the linuxbox can ping the internet, 192.168.1.* and 192.168.2.* and all
connected computers can ping all of the 3 linuxbox ip addresses and
everybody in their network but no one in the other network and no one
on the internet.

so now I need some help on what to do so that both networks can
communicate with each other and the internet.

 
Reply With Quote
 
 
 
 
Wayne McClaine
Guest
Posts: n/a

 
      01-05-2007, 06:33 PM

xix xeaon wrote:
> I think I've got most of this put together quite nicely but there is
> one critical part I don't know what to do about, the networks can't
> communicate with each other.
>
> I have one normal pc with linux on (kubuntu 6.10, fresh install) and it
> has one ethernet port on the motherboard (eth2) which is connected to a
> cable modem that does not require any authentication. in this box I
> have 2 pci ethernet cards, one is connected to a wireless access point
> (eth0) that does not require any authentication and the other is
> connected to a wired switch (eth1).
>
> on eth2 I get a global ip (83.249.178.41/19), on eth0 I've set
> 192.168.1.1/24 and on eth1 I've set 192.168.2.1/24. I've installed
> dhcp3-server and set it to listen on eth0 and eth1. I've created the
> two subnets and all wireless gets 192.168.1.11-100/24 and all wired
> gets 192.168.2.11-100/24 and the default gateways 192.168.1.1 and
> 192.168.2.1 respectively. everybody also gets the broadcast address
> 192.168.255.255 and the 2 dns servers from my isp as well as the 2 dns
> servers of opendns.
> all connected computers run windows xp home or pro.
>
> the linuxbox can ping the internet, 192.168.1.* and 192.168.2.* and all
> connected computers can ping all of the 3 linuxbox ip addresses and
> everybody in their network but no one in the other network and no one
> on the internet.
>
> so now I need some help on what to do so that both networks can
> communicate with each other and the internet.


Short answer:

ip_forward and iptables. If you only wanted to go from 192.168 OUT to
the Internet, then you could also do this with a squid-proxy (if you're
only looking to get out with HTTP).

ip_forward (use /etc/sysctl.conf and set to "1) makes the Linux box
route. Ubuntu doesn't offer anything via Search so I can't verify a
command for ya.

iptables will do the NAT, start here:
http://www.netfilter.org/documentati...NAT-HOWTO.html,
specifically, look into masquerading.

This site looks like a good intro:
http://www.gophernet.org/articles/iptables/

-Gary

 
Reply With Quote
 
Snowbat
Guest
Posts: n/a

 
      01-05-2007, 11:18 PM
On Fri, 05 Jan 2007 10:57:12 -0800, xix xeaon wrote:

> the linuxbox can ping the internet, 192.168.1.* and 192.168.2.* and all
> connected computers can ping all of the 3 linuxbox ip addresses and
> everybody in their network but no one in the other network and no one on
> the internet.
>
> so now I need some help on what to do so that both networks can
> communicate with each other and the internet.


Running the following commands should achieve what you need, namely
load the iptable_nat module, masquerade your eth2 interface via NAT, and
enable IP forwarding.

sudo modprobe iptable_nat
sudo iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward

More details at
https://help.ubuntu.com/community/In...nectionSharing


> everybody also gets the broadcast address 192.168.255.255


They shouldn't. There should be a broadcast address for each subnet:
192.168.1.0/24 broadcast address 192.168.1.255
192.168.2.0/24 broadcast address 192.168.2.255



--


--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help providing wireless Internet access to Ipaq from linuxbox drumvudu Linux Networking 0 12-26-2006 12:41 PM
PCI wifi card + linuxbox *vs.* router Mitchua Wireless Internet 8 02-01-2004 04:08 AM



1 2 3 4 5 6 7 8 9 10 11