LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   routing (https://www.linuxquestions.org/questions/linux-networking-3/routing-61540/)

Wimpie22 05-24-2003 09:54 AM

routing
 
Hello,

i have a question
i have a linuxbak with 2 network cards

eth0 ip: 10.0.0.138/ 255.255.255.0 connected to the adsl router ip 10.0.0.138/255.255.255.0
eth1 ip: 192.168.1.1/255.255.255.0 connected with a swith and a pc 1p: 192.168.1.3/255.255.255.0

how can i edit the routing table so i can acces internet throw the linux machine or do i have to change my netmasks???


help me


greeting

Wimpie

david_ross 05-24-2003 10:05 AM

Do you mean that you have other machines on the network that you want to let have internet access through linux. Like:
Code:

          [Internet]
              |
            (eth0)
          [Linux PC]
            (eth1)
              |
          [HUB/Switch]
          /  |  \
          /    |    \
      [PC1] [PC2] [PC3]


Wimpie22 05-24-2003 10:38 AM

yes can you help me bij giving me help

route add -net xx.xx.x.x.x..x

i have redhat linux 8.0

tnx

dorian33 05-24-2003 10:43 AM

Re: routing
 
Quote:

Originally posted by Wimpie22
eth0 ip: 10.0.0.138/ 255.255.255.0 connected to the adsl router ip 10.0.0.138/255.255.255.0

I think it won't work. The IPs cannot be the same.

Wimpie22 05-24-2003 10:45 AM

ip etho 10.0.0.153
ip eth1 192.168.1.1

ip router 10.0.0.138

ip pc 192.168.1.3


sorry can you help me now??

david_ross 05-24-2003 10:46 AM

1)Set the default gateways on each PC on the inside of the linux router to being the IP address of the linux router.

2) Enable ip forwarding on the linux router only:
echo 1 > /proc/sys/net/ipv4/ip_forward

3) Enable ip masquerading on the linux router only:
$IPTABLES -A FORWARD -i 10.0.0.138 -o 192.168.1.1 -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i 192.168.1.1 -o 10.0.0.138 -j ACCEPT

Wimpie22 05-24-2003 11:37 AM

hello

so i have to set on the pc

ip: 192.168.1.3
netmask 255.255.255.0
gateway 10.0.0.138

that does not work i think

Wimpie22 05-24-2003 11:39 AM

i have to upgrade my kernel or my iptables says linux how>?

david_ross 05-24-2003 11:41 AM

no - the gateway should be the 192.168.1.1 address.
did you run iptables an not ipchains? My commands shold have been:
/sbin/iptables -A FORWARD -i 10.0.0.138 -o 192.168.1.1 -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A FORWARD -i 192.168.1.1 -o 10.0.0.138 -j ACCEPT

Wimpie22 05-24-2003 11:44 AM

sorry i have installed 7.3 and not 8.0 is that the problem

greeting

wimpie

Wimpie22 05-24-2003 11:46 AM

i have iptables version 1.2.5

can that help you

david_ross 05-24-2003 11:50 AM

Yes you will need to use ipchains:
/sbin/ipchains -A forward -j MASQ -s 192.168.1.0/24 -d 0/0

Wimpie22 05-24-2003 11:56 AM

hello

i have put in the line is that all

i can now telnet my router but i dont have a connection to internet my router give out ip adresses by dhcp but i put a static ip for my eth0 from my linux server can that be the problem

david_ross 05-24-2003 01:31 PM

It could be a dns issue can you try the following two commands and see if you get any replies:
ping www.linuxquestions.org
ping 64.179.4.146

Wimpie22 05-24-2003 01:40 PM

Hello

Ping 64.179.4.146 works
ping www.linuxquestions.org does not work

so its a dns problem i gues
what can i do about it


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