[linux] 2 bramy domyślne = problem

0

Witam.
Na serwerze pojawiła się nowa karta sieciowa która łączy serwer z drugą bramą.

eth0: 192.168.0.2
eth1: 192.168.1.2

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth1
default         192.168.0.1     0.0.0.0         UG    1      0        0 eth0

Gdy zrobie wpis z nową bramą 192.168.1.1, przestaje działać dostęp do serwera z zewnątrz(przez brame 192.168.0.1); np strona www sie nie ładuje z serwera. Lokalnie wszystko działa.
Potrzebuję 2 bramy aby ściągać pliki np. przez wget'a(--bind-address).

0

ip rules + ip route ... table
Czyli 2 tablice routingu

0

Możesz napisać przykład?
Bo nie wiem jak się za to zabrać.
Nie wiem na czym ma polegać ta idea 2 bram aby działało, jeśli nie działa "moja" konfiguracja.

0

Poczytaj o ip route

0

Przegrzebałem strone http://pl.docs.pld-linux.org na google próbowałem szukać(dokładnie to nie wiem nawet co - ip route nie dużo mówi). Od kumpla pożyczyłem książkę "sieci linux receptury" i nic, kumpel też nie ma pojęcia jak to skonfigurować.
Proszę o pomoc, pilnie mi to potrzebne.

0
eth0: 192.168.0.2
eth1: 192.168.1.2

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth1
default         192.168.0.1     0.0.0.0         UG    1      0        0 eth0
ip route add 192.168.0.2/24 dev eth0 
ip route add 192.168.1.2/24 dev eth1 table 5
ip route add default via 192.168.0.1 dev eth0
ip route add default via 192.168.1.1 dev eth1 table 5

To spowoduje, że ruch z 0.2 pójdzie przez 0.1 jako gateway, a 1.2 przez 1.1.

0

Wykasowałem wpisy w route, wpisałem tak jak podałeś(bez /24 bo wywalało error'a)
I nie działa:

# ip route
192.168.0.2 dev eth0  scope link
192.168.1.0/24 dev eth1  proto kernel  scope link  src 192.168.1.2
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.2
default via 192.168.0.1 dev eth0
# ip route list table 5
192.168.1.2 dev eth1  scope link
default via 192.168.1.1 dev eth1
# ping wp.pl -I eth0
PING wp.pl (212.77.100.101) from 192.168.0.2 eth0: 56(84) bytes of data.
64 bytes from www.wp.pl (212.77.100.101): icmp_seq=1 ttl=248 time=22.7 ms
^C
--- wp.pl ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 22.795/22.795/22.795/0.000 ms
# ping wp.pl -I eth1
PING wp.pl (212.77.100.101) from 192.168.1.2 eth1: 56(84) bytes of data.
^C
--- wp.pl ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1009ms

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.2     *               255.255.255.255 UH    0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0        
0

192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.2

Tego wpisu na pewno masz nie miec w głównej tablicy tylko w 5! Dlatego Ci /24 errora wywala...

0

Dalej nic.
Ten Twój zapis 192.168.1.2/24 jest niepoprawny, pierwszy raz takie coś widzę i dalej nie podchodzi.
Zrobiłem tak:

//interfejs eth0 jest włączony
# ip route list
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.2
# ifconfig eth1 192.168.1.2 up
# ip route list
192.168.1.0/24 dev eth1  proto kernel  scope link  src 192.168.1.2
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.2

//więc kasuje wpis(tak jak pisałeś)
# ip route del 192.168.1.0/24
# ip route add default via 192.168.0.1 dev eth0
# ping wp.pl -I eth0 // ok

# ip route add 192.168.1.2/24 dev eth1 table 5
RTNETLINK answers: Invalid argument

//więc inaczej
# ip route add 192.168.1.0/24 src 192.168.1.2 dev eth1 table 5
# ip route list table 5
192.168.1.0/24 dev eth1  scope link  src 192.168.1.2

# ip route add default via 192.168.1.1 dev eth1 table 5
RTNETLINK answers: No such process

I dalej nie działa jak ma działać...
System slackware 12.2(zapomniałem dodać...)

0

bla, wybacz.

ip a add 192.168.0.2/24 dev eth0
ip a add 192.168.1.2/24 dev eth1
ip route add default via 192.168.0.1 dev eth0
ip route add default via 192.168.1.1 dev eth1 table 5
ip rule add dev eth1 table 5

Jakoś tak. Nie chce mi się instalacji testowej robić teraz...

0
Qyon napisał(a)

bla, wybacz.
ip a add 192.168.0.2/24 dev eth0
ip a add 192.168.1.2/24 dev eth1
ip route add default via 192.168.0.1 dev eth0
ip route add default via 192.168.1.1 dev eth1 table 5
ip rule add dev eth1 table 5

> Jakoś tak. Nie chce mi się instalacji testowej robić teraz...

Linijka typu
`ip a add 192.168.1.2/24 dev eth1`
Chyba nie jest potrzebna, gdyż po podniesieniu interfejsu, widnieje wpis

ip a

2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether ADDR_MAC brd ff:ff:ff:ff:ff:ff
inet 192.168.1.2/24 brd 192.168.1.255 scope global eth1


A po wykonaniu:

ip route add default via 192.168.1.1 dev eth1 table 5
ip rule add dev eth1 table 5

Ping dalej nie idzie przez interfejs eth1.
0

ip rule add 192.168.1.0/24 table 5

0

Ciężka sprawa....

# ip rule add 192.168.1.0/24 table 5
Error: argument "192.168.1.0/24" is wrong: Failed to parse rule type
0

u mnie działa...

0

Podaj co dokładnie wpisałeś i końcowe wyniki z ip route, route itp. Może coś uda mi się ustawić.
Jaki masz system?
Z góry dziękuję za pomoc.

1 użytkowników online, w tym zalogowanych: 0, gości: 1