LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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
 
LinkBack Search this Thread
Old 08-11-2008, 10:32 PM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: Chicago
Distribution: CentOS
Posts: 1,249

Rep: Reputation: 53
eth0:1 IP taking precedence for outgoing connections over eth0


My eth0:1 IP taking precedence for outgoing connections over eth0

Ex. I have 2 IPs on the server, both assigned to eth0

when I ssh to another server, and hit w, it shows I am connected as the IP of eth0:1

Also when sending mail, it has the IP or eth0:1, instead of the servers main IP of eth0, which is causing mail to bounce for no PTR record.

I know I can add a PTR to the eth0:1 IP, but do you know how I can get hte IP to show as the eth0 IP for all outbound connections?

I stopped the firewall and even ran an iptables -F but the same thing still happens.

TIA!

Last edited by abefroman; 08-11-2008 at 10:34 PM.
 
Old 08-11-2008, 10:34 PM   #2
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 120Reputation: 120
Can you show ifconfig and route outputs
 
Old 08-11-2008, 10:39 PM   #3
abefroman
Senior Member
 
Registered: Feb 2004
Location: Chicago
Distribution: CentOS
Posts: 1,249

Original Poster
Rep: Reputation: 53
Quote:
Originally Posted by billymayday View Post
Can you show ifconfig and route outputs
Sure:
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0F:EA:F4:F3:40
inet addr:xxx.xx.7.106 Bcast:xxx.xx.7.255 Mask:255.255.255.0
inet6 addr: fe80::20f:eaff:fef4:f340/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:55819384 errors:0 dropped:0 overruns:499 frame:499
TX packets:11694775 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:230216797 (219.5 MiB) TX bytes:2373278725 (2.2 GiB)

eth0:1 Link encap:Ethernet HWaddr 00:0F:EA:F4:F3:40
inet addr:xxx.xx.6.154 Bcast:xxx.xx.6.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

There are actually 21 IPs on that server, I have truncated ifconfig, but the output from route is kinda long:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
xxx.xx.7.222 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.107 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.6.147 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.108 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.14 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.109 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.168 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.110 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.111 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.112 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.6.174 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.167 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.113 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.114 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.115 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.6.173 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.6.155 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.6.154 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.7.211 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.6.184 * 255.255.255.255 UH 0 0 0 eth0
xxx.xx.6.0 * 255.255.255.0 U 0 0 0 eth0
xxx.xx.7.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
default xxx.xx.7.1 0.0.0.0 UG 0 0 0 eth0
 
Old 08-11-2008, 10:46 PM   #4
abefroman
Senior Member
 
Registered: Feb 2004
Location: Chicago
Distribution: CentOS
Posts: 1,249

Original Poster
Rep: Reputation: 53
Actually what is happening is when it connects to a server with the IP on the same cblock as eth0, it uses the servers main IP, if it connects to a server on the same cblock as eth0:1, it uses the IP of eth0:1

If it connects to an IP not on the cblock of the eth0 or eth0:1, it uses the IP of eth0.

Is there anyway to get it to use eth0 all the time?
 
Old 08-11-2008, 10:59 PM   #5
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 120Reputation: 120
Can't you delete the route for eth0:1?
 
Old 08-11-2008, 11:36 PM   #6
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
I suspect that given two equivalent routes, the kernel will use the last one added to the table.
 
Old 08-11-2008, 11:53 PM   #7
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 69
You should be setting the netmask of the aliases to 255.255.255.255 if you don't want it to use those IPs for outbound connections.
 
Old 08-12-2008, 07:37 AM   #8
abefroman
Senior Member
 
Registered: Feb 2004
Location: Chicago
Distribution: CentOS
Posts: 1,249

Original Poster
Rep: Reputation: 53
Thanks, I'll try that.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Network Manager - Two eth0 connections? hessond Linux - Newbie 2 03-20-2008 08:04 AM
problem having either ppp0 and eth0 connections active TheHighwayman Linux - Software 1 07-27-2007 08:18 AM
eth0: incoming, eth1: outgoing on mail server ryanz Linux - Networking 1 12-28-2005 07:50 PM
Wireless network on eth1 diabled Ethernet eth0 and eth0 never comes back tadatoshi Linux - Wireless Networking 4 09-23-2004 05:57 PM
Firewall WAN eth0 LAN eth1 self-bridges, eth0 does all routeing. Nichole_knc Linux - Networking 5 07-29-2004 02:33 PM


All times are GMT -5. The time now is 05:34 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration