LinuxQuestions.org
Review your favorite Linux distribution.
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 04-21-2016, 01:37 PM   #1
matthewst
LQ Newbie
 
Registered: Nov 2014
Posts: 12

Rep: Reputation: Disabled
Red Hat 7 on Dell server. Can't get p2p1 and em1 to be connected to different subnets at the same time.


I can bring up either one and ssh and browse to it's assigned address as long as the other interface is down. If I attempt to bring the both up I can't connect to either one. Just one at a time. Both are on different subnets and have different default gateways.

em0 = 192.168.2.4
p2p1 = 67.xxx.xxx.10

netstat -rn

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 67.xxx.xxx.9 0.0.0.0 UG 0 0 0 p2p1
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 em2
67.xxx.xxx.8 0.0.0.0 255.255.255.252 U 0 0 0 p2p1
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 em2
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0


ip route show

default via 67.xxx.xxx.9 dev p2p1 proto static metric 100
default via 192.168.2.1 dev em2 proto static metric 101
67.xxx.xxx.8/30 dev p2p1 proto kernel scope link src 67.xxx.xxx.10 metric 100
192.168.2.0/24 dev em2 proto kernel scope link src 192.168.2.4 metric 100
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1

etc/sysconfig/network

#Created by anaconda
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=yourmom.myhouse.local
ADDRESS0=192.168.2.4
NETMASK0=255.255.255.0
GATEWAY0=192.168.2.1
ADDRESS1=67.xxx.xxx.10
NETMASK1=255.255.255.252
GATEWAY1=67.xxx.xxx.9


Has anyone here ever been able to get something like this to work?
 
Old 04-21-2016, 02:49 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
You can't have two default gateways, that doesn't make sense. When you access a machine on 192.168.2.0/24, it will go through em2. When you access a machine on 67.xxx.xxx.8/30, it will go through p2p1. The "default" is the one it chooses when you access a machine that isn't on either of those subnets. There can only be one default.

The servers in my office are all on two subnets. A 192.168.1.0/24 1 GbE that connects them to the rest of the network, and a 192.168.2.0/24 10 GbE that only connects them to each other. The 192.168.1.0/24 interface is set as the default, so all outbound traffic to the wide world goes out of that interface (the 10 GbE network has no access to the outside world).

Here's the config for one of the CentOS 7 machines:
Code:
$ cat /etc/sysconfig/network-scripts/ifcfg-ens1f0 
DEVICE=ens1f0
HWADDR=blah
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.144
PREFIX=24
GATEWAY=192.168.1.1
DNS1=192.168.1.2
DNS2=192.168.1.3
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no

$ cat /etc/sysconfig/network-scripts/ifcfg-ens1f1
DEVICE=ens1f1
HWADDR=blah
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.2.144
PREFIX=24
GATEWAY=192.168.2.1
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
IPV6INIT=no

$ ip route show
default via 192.168.1.1 dev ens1f0 
192.168.1.0/24 dev ens1f0  proto kernel  scope link  src 192.168.1.144 
192.168.2.0/24 dev ens1f1  proto kernel  scope link  src 192.168.2.144
 
Old 04-22-2016, 02:28 PM   #3
matthewst
LQ Newbie
 
Registered: Nov 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
I ended up using the following routing table:

echo "3 public" >> /etc/iproute2/rt_tables
ip route add 67.xxx.xxx.0/16 dev p2p1 src 67.xxx.xxx.10 table public
ip route add default via 67.xxx.xxx.9 dev p2p1 table public
ip rule add from 67.xxx.xxx.10/32 table public
ip rule add to 67.xxx.xxx.10/32 table public


I have to enter that after each reboot. Does anyone know how to make that permanent?...other than using the script here: http://brainscraps.wikia.com/wiki/Se...ork_Interfaces.
 
  


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
Setting up a Red Hat DHCP server for the first time LinuxAvatar Linux - Server 1 10-26-2011 05:43 PM
Red Hat or CentOS on Dell server PE1955 toyk Linux - Hardware 0 08-20-2008 04:07 AM
How To Update Time In Red Hat Server jmmo1981 Linux - General 2 03-08-2007 11:06 AM
Red Hat X - Failed to start the display server several times in a short time in.. mjkchi Linux - General 0 12-13-2003 11:08 AM

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

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