LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 04-20-2013, 08:51 AM   #1
typhoon_2099
LQ Newbie
 
Registered: Apr 2013
Posts: 3

Rep: Reputation: Disabled
Debian Server: Configuring forwarding between 2 NICS


Hi, I'm trying to set up my home server to act as a transparent Squid proxy but so far I have not been able to get the network configured properly to then set up Squid (which is currently not installed).

I have to NICs, eth0 is my internal network (192.168.100.0/24) which serves ip addresses using DHCP, and eth1, which is my internet facing NIC (192.168.1.0/24). I have sucessfully configured DHCP3 to assign ip addresses on eth0 and computers connected to this NIC can ping other computers, and both of the servers ip addresses, but can't ping anything on eth1's network.

I believe I have a problem with routing but don't know where the problem is. I've enabled ip forwarding in the kernel so I think the problem lies in either iptables or route.

Here's the output from some commands:

/etc/network/interfaces:
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo eth1 eth0
iface lo inet loopback

# The primary network interface
iface eth1 inet static
address 192.168.1.253
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254

iface eth0 inet static
address 192.168.100.1
netmask 255.255.255.0
broadcast 192.168.100.255
ifconfig:
Code:
eth0      Link encap:Ethernet  HWaddr 90:f6:52:00:e4:e3  
          inet addr:192.168.100.1  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fe80::92f6:52ff:fe00:e4e3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:162 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:40782 (39.8 KiB)
          Interrupt:21 Base address:0x4000 

eth1      Link encap:Ethernet  HWaddr 00:1a:a0:91:9c:4c  
          inet addr:192.168.1.253  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:a0ff:fe91:9c4c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1467 errors:0 dropped:0 overruns:0 frame:0
          TX packets:370 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:306579 (299.3 KiB)  TX bytes:75382 (73.6 KiB)
          Interrupt:20 Memory:fdfc0000-fdfe0000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:9 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:639 (639.0 B)  TX bytes:639 (639.0 B)
iptables -L:
Code:
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
route:
Code:
192.168.100.0   *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
default         192.168.1.254   0.0.0.0         UG    0      0        0 eth1
Please let me know if you can see my problem, I can't see anything but I'm not fully sure what I'm doing either.
Thanks.
 
Old 04-20-2013, 09:03 AM   #2
hamlindsza
Member
 
Registered: Aug 2012
Distribution: Debian, CentOS
Posts: 74

Rep: Reputation: Disabled
Have you configured NAT rules?

iptables -t nat -I POSTROUTING -s 192.168.100.0/24 -o eth1 -j MASQUERADE
 
Old 04-20-2013, 09:11 AM   #3
typhoon_2099
LQ Newbie
 
Registered: Apr 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
That's it!!! Is this persistent or will I need to add this to /etc/network/interfaces as an up command?
 
Old 04-20-2013, 09:14 AM   #4
hamlindsza
Member
 
Registered: Aug 2012
Distribution: Debian, CentOS
Posts: 74

Rep: Reputation: Disabled
Its not persistent, you would need to load it on boot.
 
Old 04-20-2013, 09:44 AM   #5
typhoon_2099
LQ Newbie
 
Registered: Apr 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Okay, I'll set that up. Thanks for the help!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
configuring 2 nics to talk to two different subnets on a sles10sp3 server lodonnel Linux - Networking 3 11-30-2009 09:22 AM
Configuring sendmail for mail forwarding to server Yalla-One Slackware 16 11-02-2007 06:27 PM
Masq/Forwarding with 3 NICs oaf Linux - Networking 10 10-03-2007 02:49 PM
Forwarding traffic between 2 NICs! muzzamil.luqman Linux - Networking 4 12-08-2005 05:18 PM
routing/forwarding between multiple (3+) nics sublime Linux - Networking 2 07-26-2004 02:22 AM


All times are GMT -5. The time now is 07:58 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration