Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I got 2 live/public ips ( 202.50.x.x , 202.51.x.x) with different gateways. Now iam using 202.50.x.x to browse internet ,now i want to assign the 2 ip 202.51.x.x also for same network card. How can ?
finally :
i want to assign 202.50.x.x Gateway:202.50.1.x AND 202.51.x.x
Gateway 202.51.1.x to same NIC , how can i ?
Just so you know, the system can only have 1 default gateway associated with it so if you're looking to load balance across these two nics, you'll need a different solution, that being said:
To configure the base ethernet address I assume you know the ifconfig utility:
You'll notice your routing tables will automatically setup to route 192.168.2.x traffic to the 192.168.2.1 gateway, similar for the first set of ip addresses.
My problem is linux is taking ip which added using ip alias as primary ip and trying get net using that . But i want it to use my main ip ( which is first ip of my lan card ) . how can i ?
and as these are real / public ips with 2 different gateways and subnets , is it possible that my system can be view by rest of the world using both of these ips ??
Yes you can be accessed by both public IP addresses. To make your traffic go out your primary IP just make the default gateway whichever associates with that one, like:
if you had two subnets, 192.168.1.x and 192.168.2.x
assume gateways of 192.168.1.254 and 192.168.2.254 respectively
route add default gw 192.168.1.254
vice versa for 2
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.