
05-15-2011, 08:53 AM
|
|
Junior Guru
|
|
Join Date: Apr 2006
Posts: 175
|
|
Need help regarding network routing
Hey Guys I've been using the method below so that this IP (195.122.131.0) will always be connect to eth0:0's IP
route add -net 195.122.131.0 gw 94.xx.xx.254 netmask 255.255.255.0 dev eth0:0
But it only works for port80 of 195.122.131.0 (i think). How do i do it for other port like 443?
Thanks alot (I'm willing to pay $10 to those who help me)
Last edited by kohkindachi; 05-15-2011 at 09:04 AM.
|

05-15-2011, 04:59 PM
|
|
Web Hosting Evangelist
|
|
Join Date: Aug 2008
Location: Seattle, WA
Posts: 463
|
|
You can't do this (at all) with routing. You could create an IPTables forwarding rule, though...
You should be able to cobble together what you need from this page:
http://www.cyberciti.biz/faq/linux-p...with-iptables/
__________________
Cloud Computing | Dedicated Servers w/ KVMoIP | Hosted Exchange
Westin Carrier Hotel | Seattle, WA || Starbucks Center | Seattle, WA
IPv6 Enabled
Uptime | Atlas Networks
|

05-16-2011, 07:42 AM
|
|
Junior Guru
|
|
Join Date: Apr 2006
Posts: 175
|
|
I've no idea how to dit  I'll be paying someone who can help me
|

05-16-2011, 07:45 AM
|
|
Premium Member
|
|
Join Date: Jan 2011
Location: Varna, Bulgaria
Posts: 1,163
|
|
Doing this with "dev eth0:0" is not the right way to do it.
Try this:
Quote:
|
ip route add 195.122.131.0/24 via 94.xx.xx.254 src y.y.y.y
|
where y.y.y.y is your IP that you want to use to reach that subnet.
|

05-16-2011, 07:50 AM
|
|
Junior Guru
|
|
Join Date: Apr 2006
Posts: 175
|
|
Hi, I tried but
Quote:
[root@ns208842 ~]# ip route add 195.122.131.0/24 via 94.xx.xx.254 src 178.xx.xx.255
RTNETLINK answers: File exists
|
|

05-16-2011, 07:53 AM
|
|
Premium Member
|
|
Join Date: Jan 2011
Location: Varna, Bulgaria
Posts: 1,163
|
|
Ok, then, try this:
Quote:
ip route del 195.122.131.0/24
ip route add 195.122.131.0/24 via 94.xx.xx.254 src 178.xx.xx.255
ip route flush cache
|
and see if it helps
|

05-16-2011, 07:53 AM
|
|
Premium Member
|
|
Join Date: Jan 2011
Location: Varna, Bulgaria
Posts: 1,163
|
|
By the way if your IP really ends with .255 this may cause all kind of problems to you.
|

05-16-2011, 08:06 AM
|
|
Junior Guru
|
|
Join Date: Apr 2006
Posts: 175
|
|
Quote:
Originally Posted by rds100
Ok, then, try this:
and see if it helps
|
Hi thanks. that /24 works for port 443?
|

05-16-2011, 08:09 AM
|
|
Premium Member
|
|
Join Date: Jan 2011
Location: Varna, Bulgaria
Posts: 1,163
|
|
It doesn't care about ports. All connections to 195.122.131.0/24 should be initiated with the specified source address, no matter the ports.
|

05-16-2011, 08:27 AM
|
|
Junior Guru
|
|
Join Date: Apr 2006
Posts: 175
|
|
Thanks alot I'll try. But how can i check all/delete entry?
|

05-16-2011, 08:29 AM
|
|
Premium Member
|
|
Join Date: Jan 2011
Location: Varna, Bulgaria
Posts: 1,163
|
|
ip route
to list the routing table
ip route add ... to add entry
ip route del ... to delete
But be careful - don't delete your defaultroute
|

05-16-2011, 08:39 AM
|
|
Junior Guru
|
|
Join Date: Apr 2006
Posts: 175
|
|
Ok I saw it. BTW will this work
ip route add 195.122.0.0/24 via 94.xx.xx.254 src 178.xx.xx.255 ?
I want it to be effective for 195.122.XX.XX, or 195.XX.XX.XX. How can i do it?
Sorry I'm really lousy at all these
|

05-16-2011, 08:41 AM
|
|
Premium Member
|
|
Join Date: Jan 2011
Location: Varna, Bulgaria
Posts: 1,163
|
|
195.122.x.x is 195.122.0.0/16 (=netmask 255.255.0.0)
195.x.x.x is 195.0.0.0/8 (=netmask 255.0.0.0)
But that IP ending with .255 is goind to cause you problems.
|

05-16-2011, 08:50 AM
|
|
Junior Guru
|
|
Join Date: Apr 2006
Posts: 175
|
|
|

05-16-2011, 01:59 PM
|
|
Web Hosting Evangelist
|
|
Join Date: Aug 2008
Location: Seattle, WA
Posts: 463
|
|
Restating the problem:
You want a specific host (195.122.131.0) to always connect to your server's eth0:0 IP.
You -cannot- control the IP that the host connects to with the route command on the server. The host is going to connect to whatever IP it wants on your server. The only thing you can do is redirect, using IPTables, all the traffic from that host to the subinterface you want it to go to.
__________________
Cloud Computing | Dedicated Servers w/ KVMoIP | Hosted Exchange
Westin Carrier Hotel | Seattle, WA || Starbucks Center | Seattle, WA
IPv6 Enabled
Uptime | Atlas Networks
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|