LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   eth0:1 IP taking precedence for outgoing connections over eth0 (https://www.linuxquestions.org/questions/linux-networking-3/eth0-1-ip-taking-precedence-for-outgoing-connections-over-eth0-662128/)

abefroman 08-11-2008 10:32 PM

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!

billymayday 08-11-2008 10:34 PM

Can you show ifconfig and route outputs

abefroman 08-11-2008 10:39 PM

Quote:

Originally Posted by billymayday (Post 3244271)
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

abefroman 08-11-2008 10:46 PM

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?

billymayday 08-11-2008 10:59 PM

Can't you delete the route for eth0:1?

Mr. C. 08-11-2008 11:36 PM

I suspect that given two equivalent routes, the kernel will use the last one added to the table.

chort 08-11-2008 11:53 PM

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.

abefroman 08-12-2008 07:37 AM

Thanks, I'll try that.


All times are GMT -5. The time now is 12:06 PM.