View previous topic :: View next topic |
Author |
Message |
mdcollins05 n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 11 Mar 2007 Posts: 7
|
Posted: Sun Jun 03, 2007 7:54 pm Post subject: 2 interface router- no internet, dhcp seems to work |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
ricce_n Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/1636389294466300539f309.jpg)
Joined: 01 Jul 2004 Posts: 130
|
Posted: Sun Jun 03, 2007 8:22 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
mdcollins05 n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 11 Mar 2007 Posts: 7
|
Posted: Sun Jun 03, 2007 11:14 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
|