LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


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

Rep: Reputation: 15
internet sharing on an existing network


Hi,

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:
Code:
    ++++++++++++++++++
    + internet cloud +
    ++++++++++++++++++
             |
             |-------------------------  83.14.15.0/?
             |
++++++++++++++++++++++++++++++
+ Speedtouch modem/router    +
+ dhcp-server = on           +
+ ip1 = 83.14.15.16          +
+ ip2 = 10.0.0.138           +
+ ip2mac = 00:90:d0:1c:xx:1b +
++++++++++++++++++++++++++++++
             |
             |
 --------------------------------------   10.0.0.0/24
     |                           |
     |                           |
     |                           |
+++++++++++++++++       ++++++++++++++++++++++++++++++++
+ pc 1          +       + linux pc 2                   +
+ ip = 10.0.0.2 +       + ipforwarding = on            +
+++++++++++++++++       + dhcp3-server = on            +
                        + dnsmasq = on                 +
                        + eth1 = 10.0.0.7              +
                        + eth0 = 192.168.0.1           +
                        + eth1_mac = 00:02:1e:f1:xx:51 +
                        + eth0_mac = 00:48:54:7A:xx:70 +
                        ++++++++++++++++++++++++++++++++
                                 |
                                 |
                         --------------   192.168.0.0/24
                           |
                           |
                           |
             ++++++++++++++++++++++++++++++
             + pc3                        +
             + ip = 192.168.0.5           +
             + 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:

Quote:
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: 192.168.0.5 (192.168.0.5), Dst: 192.168.0.1 (192.168.0.1)

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: 192.168.0.5 (192.168.0.5), Dst: 216.239.59.104 (216.239.59.104)
You can see that the ip address 192.168.0.5 is being used towards the primary router. When the primary router wants to respond, I think it causes an address unreachable because 192.168.0.5 is not in the subnet 10.0.0.0/24.

If I do a ping from my linux pc:
Quote:
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: 10.0.0.7 (10.0.0.7), Dst: 216.239.59.104 (216.239.59.104)
I get the following reply:
Quote:
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: 216.239.59.104 (216.239.59.104), Dst: 10.0.0.7 (10.0.0.7)
I'm not able to add routing tables on my speedtouch router.
 
Old 03-07-2008, 10:23 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You are adding another network rather than a subnet. The easiest way would be to subnet the 10.0.0.0 address space. If you did that, then you could use forwarding alone to share the internet. You could have one subnet at 10.0.0.0 and another ( for pc3 ) at 10.0.1.0 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: 192.168.1.0/25 and 192.168.1.128/25. 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
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,668
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
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 "10.0.0.138," 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 "192.168.0.1" 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.
 
  


Reply

Tags
internet, sharing, subnet



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:17 AM.

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