LinuxQuestions.org
Help answer threads with 0 replies.
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 11-28-2014, 09:41 PM   #1
barn63
Member
 
Registered: Jan 2006
Location: Macomb, IL
Distribution: Slackware 13.1
Posts: 152

Rep: Reputation: 17
IP forwarding question


I have been looking at forwarding for an upcoming project and trying to test stuff on a VM. If I set up a system that has two NICs that have IPs in seperate subnets and I enable ip forwarding, should these interfaces be able to ping each other?


Also, if I have the following setup:

eth0: xxx.xxx.xxx.185/30 (xxx.xxx.xxx.186 is the gateway, all from ISP)
eth1: yyy.yyy.yyy.1/24 (interior network/non routable IPs)
Gateway: xxx.xxx.xxx.186

If I turn on forwarding, and issue the following command:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

should I be able to ping IPs on the internet from eth1's IP.

I can ping anywhere on the internet from eth0. I get "Destination Host Unreachable" when I ping eth0 or the internet from eth1.

Thank you for any input.
 
Old 11-29-2014, 02:19 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,347

Rep: Reputation: Disabled
Locally generated traffic isn't handled by the POSTROUTING chain. If you sniff packets with tcpdump, you should see that the source address is unchanged.

If you want to perform source NAT on outbound traffic on eth0 originating from local processes bound to the IP address of another interface, use the OUTPUT chain in the nat table.

By the way, exactly which command are you running that generates a "destination host unreachable" message?

Last edited by Ser Olmy; 11-29-2014 at 02:21 PM.
 
Old 11-30-2014, 12:46 AM   #3
barn63
Member
 
Registered: Jan 2006
Location: Macomb, IL
Distribution: Slackware 13.1
Posts: 152

Original Poster
Rep: Reputation: 17
That makes sense. I never thought about how locally generated traffic would be handled.

If eth0 is my external interface and eth1 is my internal interface, I got "destination host unreachable" when I would ping one interface from the other.
 
Old 11-30-2014, 02:51 AM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,347

Rep: Reputation: Disabled
What exactly do you mean by "ping one interface from another"? Are you specifying the interface with the -I parameter to the ping command? If so, that option specifies the outgoing (source) interface, not simply the source address of the IP packet. Sending a packet out interface X when it's destined for an address reachable via interface Y is indeed going to result in a "destination host unreachable" message.
 
  


Reply


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
Port forwarding question factor3 Linux - Networking 17 03-14-2014 03:24 PM
Port forwarding question linuxpyro Linux - Networking 3 10-22-2004 08:13 PM
could i ask a question about forwarding a packet mostafa_ezz Linux - Networking 0 02-07-2004 02:05 PM
Question about Ip/Port Forwarding Half_Elf Linux - Networking 3 10-14-2002 02:47 PM
Ip Forwarding Question NUX Linux - Security 4 08-12-2002 01:26 PM

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

All times are GMT -5. The time now is 03:58 PM.

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