Solved

set default route for virtual IP address

Posted on 2010-11-12
8
1,202 Views
Last Modified: 2012-05-10
Is there a way to set a default route for a virtual IP on a linux box?
0
Comment
Question by:mw-hosting
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 9

Expert Comment

by:avilov
ID: 34123768
did you try to specify
GATEWAY=

in ifcfg.ethx.y?  (x is a yor phisical interface where virtual IP is configured and y is VLAN # for that virtual IP)
0
 
LVL 12

Expert Comment

by:mccracky
ID: 34123974
If you tell us how you set the virtual IP it would help us answer your question.  If you are using the sysconfig files, you just need to put in the GATEWAY parameter like mentioned above.
0
 

Author Comment

by:mw-hosting
ID: 34124043
I did it via Webmin.
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 9

Expert Comment

by:avilov
ID: 34124094
if you can telnet/ssh to that server. the file you need to change is in


/etc/sysconfig/network-scripts  

directory

the file name will be like ifcfg.ethx.y?  (x is a yor phisical interface where virtual IP is configured and y is VLAN # for that virtual IP)
0
 
LVL 12

Expert Comment

by:mccracky
ID: 34124900
in webmin is there a place to set the Gateway?
0
 

Author Comment

by:mw-hosting
ID: 34124996
Just netmask, broadcast, MTU.
0
 
LVL 16

Accepted Solution

by:
The--Captain earned 500 total points
ID: 34125373
None of the above is going to work, unless of course you are talking about adding the *same* gateway to your virtual IP, which would make no sense (because it's completely unecessary).  

If you want to use a *different* gateway for your virtual IP (which is the only thing that makes sense), you need to implement policy routing to use a different default route based upon your source IP.

Something like this:

ip route add ExternalNet/ExternalCIDR dev eth0 src MyVirtualIP table MyNewTable
ip route add default via MyNewDefaultGw table MyNewTable
ip route add 127.0.0.0/8 dev lo table MyNewTable
ip rule add from MyVirtualIP table MyNewTable

That might not be exactly it, but you get the idea...

Cheers,
-Jon
0
 
LVL 16

Expert Comment

by:The--Captain
ID: 34281482
Thanks for the recognition.  Linux rules in so many ways, but the main reason I love it is because it is so flexible - it can do almost *anything* as far as networking is concerned (and far more than any other OS or IOS of which I know) if you just know how to configure it (and tcpdump, strace, and gdb are at the ready to diagnose anything the logs won't tell you ;-)

In any case, I'm glad to see you using linux as a router - too few people do <cisco rant deleted>

-Jon
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question