Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-07-2008, 07:05 PM   #1
Registered: Jul 2007
Location: /home
Distribution: Debian
Posts: 37

Rep: Reputation: 15
internet sharing on an existing network


I'm trying to add a new subnet to my network and enable internet sharing for that subnet.
I read a lot of guides and now it works halfway. I can send packets to the outside world, but I cannot receive anything back because my subnet isn't known in my primary router.

I think it has something to do with nat. But I haven't been able to find the correct guide to enable it.

My network topology:
    + internet cloud +
+ Speedtouch modem/router    +
+ dhcp-server = on           +
+ ip1 =          +
+ ip2 =           +
+ ip2mac = 00:90:d0:1c:xx:1b +
     |                           |
     |                           |
     |                           |
+++++++++++++++++       ++++++++++++++++++++++++++++++++
+ pc 1          +       + linux pc 2                   +
+ ip = +       + ipforwarding = on            +
+++++++++++++++++       + dhcp3-server = on            +
                        + dnsmasq = on                 +
                        + eth1 =              +
                        + eth0 =           +
                        + eth1_mac = 00:02:1e:f1:xx:51 +
                        + eth0_mac = 00:48:54:7A:xx:70 +
             + pc3                        +
             + ip =           +
             + ip_mac = 00:C0:9F:0E:xx:84 +
It seems that dns is working, but I think that's because I installed dnsmasq on the linux pc.

Now why ping doesn't work:

trace on eth0:
Ethernet II, Src: QuantaCo_0e:xx:84 (00:c0:9f:0e:xx:84), Dst: DigitalS_7a:xx:70 (00:48:54:7a:xx:70)
Internet Protocol, Src: (, Dst: (

trace on eth1:
Ethernet II, Src: SimtelSR_f1:xx:51 (00:02:1e:f1:xx:51), Dst: ThomsonT_1c:xx:1b (00:90:d0:1c:xx:1b)
Internet Protocol, Src: (, Dst: (
You can see that the ip address is being used towards the primary router. When the primary router wants to respond, I think it causes an address unreachable because is not in the subnet

If I do a ping from my linux pc:
Ethernet II, Src: SimtelSR_f1:xx:51 (00:02:1e:f1:xx:51), Dst: ThomsonT_1c:xx:1b (00:90:d0:1c:xx:1b)
Internet Protocol, Src: (, Dst: (
I get the following reply:
Ethernet II, Src: ThomsonT_1c:xx:1b (00:90:d0:1c:xx:1b), Dst: SimtelSR_f1:xx:51 (00:02:1e:f1:xx:51)
Internet Protocol, Src: (, Dst: (
I'm not able to add routing tables on my speedtouch router.
Old 03-07-2008, 10:23 PM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680
You are adding another network rather than a subnet. The easiest way would be to subnet the address space. If you did that, then you could use forwarding alone to share the internet. You could have one subnet at and another ( for pc3 ) at for example. Another option is to use NAT on linux pc 2 to translate pc3's address.

I think you are right in that, because the router is in NAT mode rather than in routing mode, and this constrains you to use 10.x.x.x for the lan. The router has no way of knowing whether to forward 192.168.0.X traffic to pc1 or pc2.

One thing to double check is whether the "nf_conntrack" module is loaded. I once subnetted my 192.168.0.X home network to use my laptop to forward traffic between my desktop and my wireless router. I used two subnets: and This didn't work until I modprobed the ip_conntrack module. ( Note, that this was what this module was called in the kernel I had at the time. ) I though that this module was just used for masquerading, but I guess not.
Old 03-08-2008, 11:33 AM   #3
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,154
Blog Entries: 4

Rep: Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232
You really don't want to have anything with a "192.168.x.x" address on a network that's "10.x.x.x" unless that second ethernet-adapter points to an entirely separate network ... causing this computer to be, in effect, a bridge between the two.

Each ethernet adapter has its own routing table which specifies how packets are to move from their source to their destination. Your "eth1" adapter faces to 10.x.x.x and therefore is the target for any traffic bound there. Your "eth2" adapter faces "192.168.x.x" and is the target only for traffic bound to that subnet. Finally, your "gateway" to the outside world is at "," which means that it is your only gateway; "eth2" should not have a gateway address because it cannot reach the outside. Packets destined for Antarctica won't go anywhere from here if they go out through that pipe, and you don't want to give your computer the mistaken impression that it can choose between two routes.

Other computers, on the subnet to which your "eth2" adapter is facing, would use the "" address of that adapter as their gateway, since as far as they are concerned that's what it is. Your computer will then reflect those packets back out through its "eth1" on its way to the hardware-router and thence the Internet.

Last edited by sundialsvcs; 03-08-2008 at 11:34 AM.


internet, sharing, subnet

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Home network - Internet sharing Artik Linux - Networking 1 05-09-2005 08:29 AM
internet sharing on local network(with billing system) sensovision Linux - Networking 12 11-14-2004 04:43 PM
enabling internet sharing through network tehnick Slackware 4 06-06-2004 04:40 PM
Internet sharing on ad-hoc network MikeSmith36 Linux - Wireless Networking 1 02-22-2004 10:48 AM
small network RH 8.0 without internet sharing guanyu Linux - Networking 0 11-05-2002 03:20 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration