Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
2 interface router- no internet, dhcp seems to work
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
mdcollins05
n00b
n00b


Joined: 11 Mar 2007
Posts: 7

PostPosted: Sun Jun 03, 2007 7:54 pm    Post subject: 2 interface router- no internet, dhcp seems to work Reply with quote

i'm trying to get this setup as such:

wall -> cable modem -> eth0 -> eth1 -> switch

Right now i've taken my cable modem and connected it to my windows computer, which gets an ip address and internet works on it.

Ive cloned the mac address from my windows computer to my gentoo router by using:

Code:
ifconfig eth0 hw ether 00:11:2F:2A:6E:61


My gentoo server gets an ip address along with dns servers:

Code:
#ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:11:2F:2A:6E:61
          inet addr:24.23.9.xx  Bcast:255.255.255.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:576  Metric:1
          RX packets:45699 errors:5 dropped:0 overruns:0 frame:0
          TX packets:191 errors:1 dropped:0 overruns:0 carrier:1
          collisions:0 txqueuelen:1000
          RX bytes:2752068 (2.6 Mb)  TX bytes:61271 (59.8 Kb)
          Interrupt:12 Base address:0xcf00


Code:
#netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.10.10.0      0.0.0.0         255.255.255.0   U         0 0          0 eth1
24.23.8.0       0.0.0.0         255.255.254.0   U         0 0          0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U         0 0          0 lo
0.0.0.0         10.10.10.1      0.0.0.0         UG        0 0          0 eth1
0.0.0.0         24.23.8.1       0.0.0.0         UG        0 0          0 eth0


My pings to anywhere outside my network do not work, both by domain name and ip address.

Any help is appreciated, thanks!
Back to top
View user's profile Send private message
ricce_n
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jul 2004
Posts: 130

PostPosted: Sun Jun 03, 2007 8:22 pm    Post subject: Reply with quote

You need to use iptables and NAT to get that to work.

Once you enabled everything you need in the kernel and installed the iptables package, the iptables rule looks something like this:
Code:
iptables -t nat -A POSTROUTING -i eth1 -j SNAT --to-source 24.23.9.xx

You need to change 24.23.9.xx to your real IP.

if you have dynamic IP you can use MAQUERADE:
Code:
iptables -t nat -A POSTROUTING -i eth1 -j MASQUERADE


You should also enable forwarding:
in /etc/sysctl.conf change to net.ipv4.ip_forward=1 and run:
Code:
echo 1 >/proc/sys/net/ipv4/ip_forward


Edit:
I can also see that you have 2 default gateways.. you most make sure to not add 10.10.10.1 as a gateway (not on the router it self -- but most likely on the other boxes in your network)
Back to top
View user's profile Send private message
mdcollins05
n00b
n00b


Joined: 11 Mar 2007
Posts: 7

PostPosted: Sun Jun 03, 2007 11:14 pm    Post subject: Reply with quote

Thanks! even though your answer didnt fully answer mine, it set me in the right direction! ended up being that i forgot to take out the default gateway for eth1 and it also helps if i plug everything up correctly.

Thanks again.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum