LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-11-2014, 08:12 AM   #1
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 209
Blog Entries: 1

Rep: Reputation: Disabled
Problem in create permanent route on the interface


This is the config of route.eth0 on my server in /etc/sysconfig/network-scripts

Code:
GATEWAY0=172.16.252.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.40.0
after restarting the network service, there is the route for both interfaces on my server as the below:
Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.40.0    172.16.252.1    255.255.255.255 UGH   0      0        0 eth0
192.168.40.0    172.16.252.1    255.255.255.255 UGH   0      0        0 eth1
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
172.16.16.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
I have to delete the route on eth1 manually if I want the network work correctly!
 
Old 06-11-2014, 02:42 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
network-scripts is saying to set your default gateway to 172.16.252.1 but your default as shown by netstat is instead
"172.16.16.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1".

This suggests your /etc/sysconfig/network is setting 172.16.16.0 as default and overriding network-scripts file. You may want to set the route in /etc/sysconfig/network to 172.16.252.1 instead.
 
Old 06-14-2014, 04:18 AM   #3
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 209

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by MensaWater View Post
network-scripts is saying to set your default gateway to 172.16.252.1 but your default as shown by netstat is instead
"172.16.16.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1".

This suggests your /etc/sysconfig/network is setting 172.16.16.0 as default and overriding network-scripts file. You may want to set the route in /etc/sysconfig/network to 172.16.252.1 instead.
I changed the 172.16.16.2 to 172.17.17.2, and now, the route table is like as below, there are two routes for eth1,why?
Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.40.0    172.16.252.1    255.255.255.248 UGH   0      0        0 eth1
192.168.40.0    172.16.252.1    255.255.255.248 UGH   0      0        0 eth1
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
172.16.16.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
0.0.0.0         172.16.252.1    0.0.0.0

Last edited by massy; 06-14-2014 at 04:20 AM.
 
Old 06-16-2014, 07:45 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Since you've set 172.16.252.1 as the default have you taken it out of the network-scripts files? Do you have it in ifcfg-eth0 AND in a route-eth0 by any chance? Did you run service network stop then service network start?

Sometimes when making changes to ifcfg-* files it is necessary to do the "service network stop" before the change then "service network start" after the change or it doesn't clean up what the original ifcfg-* files were telling it to do.

A reboot should clear it failing all else.
 
  


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
Make route permanent rust8y Solaris / OpenSolaris 9 12-10-2007 04:10 AM
How to create a route to a usb0 interface? cmisip Linux - Networking 13 03-01-2007 11:07 PM
Permanent static Route on fedora cora 5 niurkin69 Linux - Networking 2 09-22-2006 03:56 PM
Permanent Default Route gianh Arch 3 05-07-2006 02:31 AM
Adding route and making ifconfig permanent gani *BSD 9 09-21-2004 02:01 AM

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

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