LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-13-2010, 01:18 PM   #1
rfreiberger
Member
 
Registered: Jul 2009
Location: Union City, CA, USA
Distribution: FreeBSD, Mint, CentOS
Posts: 35

Rep: Reputation: 16
How to adjust routing of external packets to one NIC instead of another NIC?


Hello,

I'm running Ubuntu 9.10 server at home on VMware Workstation 7. I have two NIC's configured, one NIC is setup to have a direct connection to the network "Bridged", another NIC is setup to have a private network connection on VMnet1.

Network card 1 - 192.168.1.160 (Bridged)
Network card 2 - 10.1.1.1 (Internal access only)

So when I try to access the Internet, I can not go out on the NIC 1. If I try to ping google.com I get a return from 10.1.1.1 "no reply". But I know that NIC 2 is working, because I can ping 192.168.1.160 from the workstation I'm running on.

So I think that my routing is sending traffic out to the wrong NIC, but not sure if this is a metric in the iptables or another place?

The reason for two NICS is to simulate a DMZ where the server will be running Squid, to test proxy from another workstation on the 10.1.1.X subnet.

Thanks!
 
Old 04-13-2010, 04:46 PM   #2
hi2arun
Member
 
Registered: Apr 2010
Distribution: Fedora
Posts: 109
Blog Entries: 4

Rep: Reputation: 34
Where is your default route pointing to?
Quote:
route -n
If the default route is via NIC-2, then you need to change it to be via NIC-1
 
Old 04-14-2010, 09:52 AM   #3
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
hi2arun is quite right - a route -n will show your default gateway and hence the default route for getting out.

What strikes me as strange is that your NIC 1 has an IP of 192.168.1.160 - which from my networking knowledge should be unroutable and hence unable to get to the internet (unless its part of a private network with another device that CAN connect to the internet and your machine is sharing the network on that box).

Lastly, you should check what DNS you have configured (more /etc/resolv.conf) - since this will be critical for doing something like # ping www.google.com
 
Old 04-14-2010, 01:20 PM   #4
rfreiberger
Member
 
Registered: Jul 2009
Location: Union City, CA, USA
Distribution: FreeBSD, Mint, CentOS
Posts: 35

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by alli_yas View Post
hi2arun is quite right - a route -n will show your default gateway and hence the default route for getting out.

What strikes me as strange is that your NIC 1 has an IP of 192.168.1.160 - which from my networking knowledge should be unroutable and hence unable to get to the internet (unless its part of a private network with another device that CAN connect to the internet and your machine is sharing the network on that box).

Lastly, you should check what DNS you have configured (more /etc/resolv.conf) - since this will be critical for doing something like # ping www.google.com
Sorry I should have pointed that out. My VMware Workstation is running on my desktop machine which is on my home network. The 192.168.1.X subnet is the home lan but has access to the Internet. It's not perfect but it's emulating what it would be like on a DMZ where the home network is the Internet.

I'm not sure it's a DNS problem, I have my DNS pointed to OpenDNS which is also used on my network. The problem is as soon as I up the second NIC, I can ping to the interfaces, but nothing can get out. As soon as I down the NIC, everything works.

I built the same environment at work, this time planning to deploy it with two subnets, similar to the same thing but instead of the DMZ I'm going to place it on the internal network but the second NIC will just have an allow rule for Internet access.
 
  


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
Forward traffic from internal NIC to external NIC laurens Linux - Newbie 4 07-30-2009 10:53 AM
Intel NIC 82551 - slow UDP Packets w/ 2.6 LesMan Linux - Hardware 0 07-27-2006 12:07 PM
Forwarding packets between two NIC madhavann Linux - Networking 6 02-17-2006 10:23 PM
2 External Nic, 1 Internal Nic Router Problem trevanda Linux - Networking 0 10-13-2004 01:20 AM
Why one nic accept packets destined for second nic gibcomp Linux - Networking 2 09-09-2004 12:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:59 PM.

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