LinuxQuestions.org
Visit Jeremy's Blog.
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 03-30-2009, 02:55 PM   #1
vivhost
LQ Newbie
 
Registered: May 2004
Posts: 7

Rep: Reputation: 0
source IP for outgoing traffic


Hello, I've been trying to research this, but I don't really understand IP routing and it's bugging me that I can't fix this problem. I have a dedicated server (fedora core 7) with 3 IP addresses on the same eth0 interface. On the default IP address 62.193.226.127, there is some routing problem because I can't connect from the server to some other sites. Using one of the other IP addresses, like 62.193.252.129, I can connect fine (for example, using wget --bind-address=62.193.252.129 ...) Additionally this address is better for sending mail because it coincides with the main domain name from which the mail is sent.

My main question is: how can I configure networking so that outgoing traffic from the box goes via 62.193.252.129 as source IP?

Here is some info:

eth0 Link encap:Ethernet HWaddr 00:18:37:09:99:87
inet addr:62.193.226.127 Bcast:62.193.227.255 Mask:255.255.252.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:155048 errors:0 dropped:0 overruns:0 frame:0
TX packets:189356 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:32241110 (30.7 MiB) TX bytes:218707677 (208.5 MiB)
Interrupt:5 Base address:0xc000

eth0:1 Link encap:Ethernet HWaddr 00:18:37:09:99:87
inet addr:62.193.252.129 Bcast:62.193.252.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:5 Base address:0xc000

eth0:2 Link encap:Ethernet HWaddr 00:18:37:09:99:87
inet addr:62.193.252.147 Bcast:62.193.252.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:5 Base address:0xc000

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
62.193.252.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
62.193.224.0 0.0.0.0 255.255.252.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 62.193.227.254 0.0.0.0 UG 0 0 0 eth0

Last edited by vivhost; 03-30-2009 at 03:02 PM. Reason: clarified question
 
Old 03-30-2009, 08:17 PM   #2
kenoshi
Member
 
Registered: Sep 2007
Location: SF Bay Area, CA
Distribution: CentOS, SLES 10+, RHEL 3+, Debian Sarge
Posts: 159

Rep: Reputation: 32
Change the device used for the default route. For example (make sure you do this from console):
Code:
route del default
route add default gw <gateway IP here> dev eth1
And make changes to your network files as follows:

- In /etc/sysconfig/network, delete the GATEWAY= line
- In /etc/sysconfig/network-scripts/ifcfg-eth1, add

GATEWAY=<gateway IP here>

Hope this helps.
 
Old 03-31-2009, 08:53 AM   #3
vivhost
LQ Newbie
 
Registered: May 2004
Posts: 7

Original Poster
Rep: Reputation: 0
OK, but I don't have an eth1... just eth0 with 3 IP addresses. So, should it be:

route del default
route add default gw 62.193.227.254 dev eth0:1

and then edit the /etc/sysconfig/network-scripts/ifcfg-eth0:1? and REMOVE the gateway from /etc/sysconfig/network?
Thanks
 
  


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
Traffic shaping (limiting outgoing bandwidth of all TCP-traffic except FTP/HTTP) ffkodd Linux - Networking 3 10-25-2008 12:09 AM
Block outgoing traffic through router? Micro420 Linux - Networking 3 03-15-2005 07:01 AM
Intercept outgoing traffic through a firewall???? macburton Linux - Security 1 10-17-2004 01:10 PM
outgoing traffic to the internet stopped esanchez Linux - Networking 4 09-22-2004 01:29 PM
How to use QoS to throttle outgoing traffic? Electrode Linux - Networking 3 06-13-2003 07:46 AM

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

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