LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 07-08-2007, 10:42 AM   #1
gzober
LQ Newbie
 
Registered: Jul 2007
Distribution: Debian
Posts: 6

Rep: Reputation: 0
debian gateway setup


hi!

i'm pretty new to linux, and have a problem
i'd like to use the debian computer as a firewall between the router and the windows computer.
my setup is: - one router connecting to the internet (192.168.1.1)
- one debian comp with two ethernet cards (eth0 192.168.1.3 to the router, eth4 192.168.1.3 to the other comp)
- one windows computer connected to the debian one. ( 192.168.1.2 set to static, dhcp off )

the problem is that internet can't get through the linux pc.

ifconfig output (i think it looks OK) :

debian:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:40:33:E22:22
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::240:33ff:fee2:d222/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2015 errors:0 dropped:0 overruns:0 frame:0
TX packets:1907 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:636522 (621.6 KiB) TX bytes:396645 (387.3 KiB)
Interrupt:11 Base address:0xec00

eth4 Link encap:Ethernet HWaddr 00:50:BF1:85:E7
inet addr:192.168.1.4 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::250:bfff:fed1:85e7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:785 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:56889 (55.5 KiB) TX bytes:1068 (1.0 KiB)
Interrupt:10 Base address:0xe800

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:88 errors:0 dropped:0 overruns:0 frame:0
TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7200 (7.0 KiB) TX bytes:7200 (7.0 KiB)p:Local Loopback

/etc/network/interfaces file:

# 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 eth0 eth4
iface lo inet loopback

# WAN - 8139
iface eth0 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1

# LAN - 8029
iface eth4 inet static
address 192.168.1.4
netmask 255.255.255.0

btw the internet on the debian comp is okay.
when the win comp is not plugged in to debian, i can ping it, but when i plug it into the second NIC card in debian comp, the win computer cant be pinged.

could anyone help me?

thanks
 
Old 07-08-2007, 12:06 PM   #2
fatzeus
Member
 
Registered: Nov 2004
Location: Venice, Italy
Distribution: Gentoo
Posts: 44

Rep: Reputation: 15
The Ips you have choose are not very good...they can cause lots of problems because you have two different networks with the same netmask.

Try something like this:

router 192.168.1.1
debian-router 192.168.1.3
debian-win 192.168.2.1
win 192.168.2.2
 
Old 07-08-2007, 12:14 PM   #3
gzober
LQ Newbie
 
Registered: Jul 2007
Distribution: Debian
Posts: 6

Original Poster
Rep: Reputation: 0
and what about the netmask? shouldn't I change that?
 
Old 07-08-2007, 12:18 PM   #4
fatzeus
Member
 
Registered: Nov 2004
Location: Venice, Italy
Distribution: Gentoo
Posts: 44

Rep: Reputation: 15
No, leave the same netmasks (255.255.255.0)
 
Old 07-08-2007, 12:32 PM   #5
gzober
LQ Newbie
 
Registered: Jul 2007
Distribution: Debian
Posts: 6

Original Poster
Rep: Reputation: 0
okay, thanks to you i'm one step closer
i did what you said and now i could ping back and forward on the lan, except I can't reach the router (192.168.1.1), therefore I cant reach the internet.
any ideas?
i'm still not confident in my windows lan card configuration:
ip: 192.168.2.2
netmask: 255.255.255.0
gateway 192.168.2.1 (linux lan) ??
dns: 192.168.2.1 (linux lan) ??
 
Old 07-08-2007, 01:08 PM   #6
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Rep: Reputation: 15
permit forwarding

Quote:
Originally Posted by gzober
okay, thanks to you i'm one step closer
i did what you said and now i could ping back and forward on the lan, except I can't reach the router (192.168.1.1), therefore I cant reach the internet.
any ideas?
i'm still not confident in my windows lan card configuration:
ip: 192.168.2.2
netmask: 255.255.255.0
gateway 192.168.2.1 (linux lan) ??
dns: 192.168.2.1 (linux lan) ??
Your windows setup is fine, assuming you actually are running a DNS server on the linux gateway (192.168.2.1). If not, you should configure the DNS server your ISP assigns.

Re the ping 192.168.1.1 problem, it sounds like you either need to enable IP forwarding on the linux gateway or add a static route on the router so it knows about the 192.168.2.0 network (or both)
Code:
cat /proc/sys/net/ipv4/ip_forward
sudo "echo 1 > /proc/sys/net/ipv4/ip_forward"
cat /proc/sys/net/ipv4/ip_forward
Can you ping 192.168.1.3 (the other side of the linux gateway)? If so, forwarding is enabled already. Since linux gateway is directly connected to the 192.168.2.x network, it knows how to get there. The router, however, needs a static route added. Go to the router's GUI, and search for routing or static routes. Add a route for network "192.168.2.0" netmask "255.255.255.0" gateway "192.168.1.3" and you'll be set.
 
Old 07-08-2007, 01:45 PM   #7
gzober
LQ Newbie
 
Registered: Jul 2007
Distribution: Debian
Posts: 6

Original Poster
Rep: Reputation: 0
i could ping 192.168.1.3

but the rest just dont work..
still the same, i cant ping 192.168.1.1
and i also did the forwarding

http://img353.imageshack.us/img353/8787/48767109td0.jpg
 
Old 07-08-2007, 09:09 PM   #8
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Rep: Reputation: 15
firewall?

Do you have some sort of firewall software running on the linux gateway? Perhaps that is blocking the ping response (echo reply)?

You should be able to run tcpdump or wireshark on the linux gateway, and see if the ping (echo request) and it's response are being seen.
 
Old 07-09-2007, 06:41 AM   #9
gzober
LQ Newbie
 
Registered: Jul 2007
Distribution: Debian
Posts: 6

Original Poster
Rep: Reputation: 0
there is no firewall.
I'll try tcpdump and wireshark, and post you the output.
but there is something interesting going on, because my 2nd NIC's name is always changing (mostly its eth4 but its sometimes eth1 or eth2..), it changes on reboots.
 
Old 07-09-2007, 06:50 AM   #10
gzober
LQ Newbie
 
Registered: Jul 2007
Distribution: Debian
Posts: 6

Original Poster
Rep: Reputation: 0
and if I try to use the 'ifup eth2' command I get this: eth2: timeout waiting for Tx RDC.
(I didnt get it until now) -.-
 
Old 07-09-2007, 07:39 AM   #11
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
To summarise;

1.eth0 must be on the same subnet as the router. i.e. they must both have addresses in 192.168.1.X
2. eth1 must be on a different subnet i.e. 192.168.0.X or 192.168.2.X or 10.X.X.X and all boxes connected to this card must have addresses in this subnet.

In order to access the Internet from boxes connected to eth1 you need to implement ip-masquerading and forwarding which is covered pretty well here. I personally have implemented ip-masquerading and use MonMotha's firewall to handle the rest.

Basically the setup is this;

the gateway for the box connected to the router is the router address. The gateway for boxes connected to eth1 is the address of eth1.
I suggest you manually edit the /etc/network/interfaces file to something like;

auto eth0
iface eth0 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1

auto eth1
iface eth1 inet static
address 192.168.X.X
gateway 192.168.1.3

Of course you need to restart networking by doing in a root consol;

/etc/init.d/networking restart

Last edited by TigerOC; 07-09-2007 at 07:50 AM.
 
  


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
How to setup a simple gateway with Debian Kanon Linux - Networking 2 12-24-2006 05:03 PM
Yet another Gateway setup question ;p Last Attacker Linux - Networking 3 05-20-2006 10:32 AM
How to setup a gateway fei Linux - Networking 1 02-03-2006 12:43 AM
Two gateway setup eqxro Linux - Networking 4 12-07-2004 01:32 AM
Gateway setup help! frost33 Linux - Networking 4 05-04-2001 07:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:17 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