LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-01-2014, 11:00 PM   #1
rootaccess
Member
 
Registered: Mar 2012
Posts: 311

Rep: Reputation: Disabled
Can someone explain this invisible route?


Code:
[08:54 PM][root@shawn shawn]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.100.0.0      0.0.0.0         255.255.254.0   U     0      0        0 br0
169.254.0.0     0.0.0.0         255.255.0.0     U     1056   0        0 br0
0.0.0.0         10.100.0.1      0.0.0.0         UG    0      0        0 br0
[08:56 PM][root@shawn shawn]# ping -c 3 192.168.2.2
PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data.
64 bytes from 192.168.2.2: icmp_seq=1 ttl=63 time=1.77 ms
64 bytes from 192.168.2.2: icmp_seq=2 ttl=63 time=1.66 ms
64 bytes from 192.168.2.2: icmp_seq=3 ttl=63 time=1.77 ms

--- 192.168.2.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 1.663/1.737/1.776/0.071 ms
I've got a multihomed portal running iptables/DHCP/DNS. I have 3 NICS, eth0 (to modem), eth1 to LAN1 (10.100.0.0/23) and eth2 to LAN2 (192.168.2.0/24).

How can these networks ping each other? Note I do have two DNS servers.
In named.conf, the listen-on is 127.0.0.1, 10.100.0.1, 192.168.2.1
the allow-query is the same.
But why are they allowed to talk to each other?
No static routes have been defined anywhere!
/etc/resolv.conf is the gateway only for the network for each machine

Last edited by rootaccess; 02-01-2014 at 11:03 PM.
 
Old 02-02-2014, 12:50 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
I don't see anything strange about this. And you do have a static route; the default route. The packets will flow like this:
  • The host "shawn" has a 10.100.0.1 as its default gateway, and sends packets destined for any non-local network to 10.100.0.1. That includes packets to 192.168.2.2.
  • 10.100.0.1/23 is bound to a NIC on a multihomed router, which also has the address 192.168.2.1/24 bound to another NIC. Hence, the router knows how to reach 192.168.2.2.
  • The host with the IP address 192.168.2.2 is presumably using 192.168.2.1 as its default gateway, so that's where it sends the reply packet.
If you have a single multihomed router acting as a gateway for two networks, then hosts in those two networks will be able to communicate unless you specifically block that communication with a firewall rule.
 
Old 02-02-2014, 01:00 AM   #3
rootaccess
Member
 
Registered: Mar 2012
Posts: 311

Original Poster
Rep: Reputation: Disabled
Yes I JUST figured this out. At first, I did not have any forward rules to allow eth1 to talk to eth2 and vice versa like:
-A FORWARD -i eth2 -o eth1 -j ACCEPT
-A FORWARD -i eth1 -o eth2 -j ACCEPT

I originally had 2 NICS, eth0 (modem) and eth1 (10.100.0.0/23)
So I only had this:

-A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -o eth0 -j ACCEPT
-A FORWARD -j DROP

When adding my 3rd NIC, I could not ping between networks. Prior to adding the additional forward rules. I was able to ping the gateways of both networks from each other, meaning on a host in the 10.100.0.0/23 network, I could ping the gateway 192.168.2.1, and vice versa

Anyway, I realized I can block or allow specific hosts in iptables. I was just messing around with that right now.
In fact, I do see that this is normal behavior for everyone to communicate since the gateway is a multihomed system with 3 NICS, I figured that it would NOT be this way until I experimented and noticed it is.

In what situtation is it NOT like this where subnets cannot speak to each other? I am asking because I plan to become an admin and this was just the simple create static route objective I wanted to do. I went out and bought a usb to ethernet NIC for the 3rd NIC. I like to go well above and beyond the objectives to have a thorough understanding of what is happening but I have no clue what switches out there can do let alone any cisco related stuff. I am wondering if it is normal that multiple subnets communicate with each other in the enterprise world? If so, I do know how to block or allow access in iptables like so:

(I would delete the original:

-A FORWARD -i eth1 -o eth2 -j ACCEPT
and replace it with:

-A FORWARD -i eth1 -o eth2 -s 10.100.0.8 -d 192.168.2.0/24 -j ACCEPT

To allow only 1 host to communicate with the entire other network
Thanks

Last edited by rootaccess; 02-02-2014 at 01:03 AM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
openvpn push route priority over existing route lievendp Linux - Networking 0 06-22-2012 07:52 AM
ECMP route are deleting when delete best route ukkreddy Linux - Newbie 0 05-18-2012 04:11 AM
Route eth2 TCP packets to tun0 with IPTABLES & IP RULE/ROUTE Thireus Linux - Networking 4 05-09-2011 12:38 PM
Default route took 20s to display with 'route' command Akhran Linux - Newbie 3 11-04-2006 04:59 AM
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 04:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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