Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have small issue on my network

I have two NIC,

NIC 1 Connected to the internet and local network, NIC 2 Connected to Sip Trunk Circuit (No Internet)

Each one of them has different Gateway.

My problem that when I ping google.com or any other public IP , sometimes it chooses Gateway in SIP gateway, and I get timeout..

How I can route HTTP requests to NIC 1 and never goes to the second NIC card?

Thanks

share|improve this question

1 Answer 1

up vote 0 down vote accepted

This is related to the fact that you may have different default gateways, depending on how your interfaces come up. The correct way to deal with this is to tell your system that the gateway for NIC1 is your default gateway, and it must be so forever:

  route delete 0.0.0.0 

this removes the current gateway;

  route -p add 0.0.0.0 mask 0.0.0.0 x.x.x.x 

where x.x.x.x is the gateway of NIC1. The -p option makes this your permanent hoice.

share|improve this answer
    
Thanks but because I have 2 gateways I need to use: route delete 0.0.0.0 x.x.x.x where the x.x.x.x the default gateway of the NIC 1 after that I use what you mention route -p add 0.0.0.0 mask 0.0.0.0 x.x.x.x Thanks :) –  AZUZ Jan 2 at 5:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.