LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-10-2012, 09:59 PM   #1
udippel
LQ Newbie
 
Registered: Mar 2012
Posts: 3

Rep: Reputation: Disabled
Question How to route a network connection through another PC (no ICS, NAT)


I have tried in vain to route traffic from PC2 through PC1 to a WAN connection.

The setup is like this: PC2 is connected to PC1 (router) via Ethernet. This works perfectly well in both directions (10.10.10.0/24).
PC1 is perfectly well connected to the Internet, with name resolution and all; and I can browse all websites (it is a DHCP-client on the WAN).

I have set the IP_forward to "1" on PC1 (router):
$ cat /proc/sys/net/ipv4/ip_forward
1

Problem: I cannot ping any IP aside of PC1 from PC2. I can ping any IP from PC1 (the one connected to WAN) at that same moment.

Therefore it looks like a routing problem. Though when I look at netstat, it looks okay(?). Since the ping from PC2 finds PC1 alright: How do I teach PC1 to route the packages from its eth0 to the WAN interface?
 
Old 03-11-2012, 03:24 AM   #2
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 193Reputation: 193
You haven't provided much useful information, but since you said the routes look right, one thing you haven't mentioned, is a masquerade firewall rule..

Assuming you are using iptables, on PC1 (the router)
Code:
 iptables -t nat -A POSTROUTING -o $wAN_IF -j MASQUERADE
Something like this would be required, to masquerade the LAN (PC2) traffic to the public ipaddress of the router (PC1).
 
Old 03-11-2012, 04:29 AM   #3
udippel
LQ Newbie
 
Registered: Mar 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Yes, I understand. Though I did not want to use NAT.
Maybe I need to give it a public IP then? That's also fine with me.

Which info is missing?
PC1 is a PC for the mobile broadband connection only. PC2 is my advanced firewall, DNS, DHCP and so forth for the internal network. But it doesn't support the G3-dongle.
 
Old 03-11-2012, 08:38 PM   #4
elfenlied
Member
 
Registered: Dec 2004
Posts: 83

Rep: Reputation: 8
Perhaps a simple network diagram would help?

Also unless you have a static IP address on your wireless broadband dongle and which also has a publicly routed subnet attached to it you won't be able to give your PC2 a public IP address. Additionally this also means since you PC2 isn't on a public routed subnet the only way you'll be able to have traffic come back to is if your gateway (PC1) NATs it's packets.
 
Old 03-11-2012, 09:14 PM   #5
udippel
LQ Newbie
 
Registered: Mar 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
[SOLVED] How to route a network connection through another PC (no ICS, NAT)

Of course, me stupid.
I ought not have overlooked the fact that PC2 needs an address. Which could either be RFC1918 - requiring NAT - or a public IP different from the one of the dongle.
I was just for the fun of it taken in by the idea that NAT and everything are done on PC2 in any case, so that I didn't want to do yet another NAT on PC1.
Though now I see my wrong ways. The problem is the 'outside' address of PC2. Can't be public through the dongle and can't be private without NAT.

My excuses for the noise,

Uwe
 
  


Reply



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
NAT and NAT Server behind its own NAT(private network) zeusys Linux - Networking 1 06-08-2011 06:22 PM
Help with NAT and route cailen.fisher Linux - Newbie 2 04-23-2009 02:56 PM
Route to NAT'd address doublejoon Linux - Networking 1 01-18-2006 12:29 PM
linux route - NO NAT champ Linux - Networking 6 08-17-2005 10:27 AM
Dial up NAT/ ICS on SuSe 9.3 confused_bof SUSE / openSUSE 1 06-12-2005 11:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:06 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