ip virtuali, qualcuno funziona qualcuno no
poniamo di avere una sarge con due schede di rete, (sono tre ma la eth2
non e' attaccata e sta' down)
le due schede vanno regolarmente, eth0 in lan con indirizzo ip
192.168.22.37 ed eth1 su internet con indirizzo ip xxx.xxx.xxx.26 /
255.255.255.248
alla eth1 ho assegnato anche altri indirizzi ip dal 27 al 30, il
problema e' che di questi indirizzi ip funzionano sono il 29 ed il 30 e
non capisco perche.
vi posto alcuni dettagli:
/etc/netword/interface configurato con etherconf
---------------------------------------------------------------------------------------------
minimale:/etc/network# cat interfaces
### etherconf DEBCONF AREA. DO NOT EDIT THIS AREA OR INSERT TEXT BEFORE IT.
auto lo eth0 eth1
iface lo inet loopback
iface eth0 inet static
address 192.168.22.37
netmask 255.255.255.0
broascast 192.168.22.255
gateway 192.168.22.1
iface eth1 inet static
address xxx.xxx.xxx.26
netmask 255.255.255.248
broadcast xxx.xxx.xxx.31
gateway xxx.xxx.xxx.25
### END OF DEBCONF AREA. PLACE YOUR EDITS BELOW; THEY WILL BE PRESERVED.
---------------------------------------------------------------------------------------------
tabella di routing:
---------------------------------------------------------------------------------------------
minimale:/etc# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
xxx.xxx.xxx.24 0.0.0.0 255.255.255.248 U 0 0 0 eth1
192.168.22.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.0.0 192.168.22.1 255.255.0.0 UG 0 0 0 eth0
0.0.0.0 xxx.xxx.xxx.25 0.0.0.0 UG 0 0 0 eth1
---------------------------------------------------------------------------------------------
indirizzi ip
---------------------------------------------------------------------------------------------
minimale:/etc# ifconfig
eth0 Link encap:Ethernet HWaddr 00:01:02:1C:65:1E
inet addr:192.168.22.37 Bcast:192.168.22.255 Mask:255.255.255.0
inet6 addr: fe80::201:2ff:fe1c:651e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1062 errors:0 dropped:0 overruns:0 frame:0
TX packets:813 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:451716 (441.1 KiB) TX bytes:148413 (144.9 KiB)
Interrupt:177 Base address:0x8800
eth1 Link encap:Ethernet HWaddr 00:0E:A6:0D:BF:4B
inet addr:xxx.xxx.xxx.26 Bcast:xxx.xxx.xxx.31 Mask:255.255.255.248
inet6 addr: fe80::20e:a6ff:fe0d:bf4b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1528 errors:0 dropped:0 overruns:0 frame:0
TX packets:1720 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:212686 (207.7 KiB) TX bytes:477051 (465.8 KiB)
Interrupt:193
eth1:1 Link encap:Ethernet HWaddr 00:0E:A6:0D:BF:4B
inet addr:xxx.xxx.xxx.29 Bcast:xxx.xxx.xxx.31 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:193
eth1:2 Link encap:Ethernet HWaddr 00:0E:A6:0D:BF:4B
inet addr:xxx.xxx.xxx.30 Bcast:xxx.xxx.xxx.31 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:193
eth1:3 Link encap:Ethernet HWaddr 00:0E:A6:0D:BF:4B
inet addr:xxx.xxx.xxx.27 Bcast:xxx.xxx.xxx.31 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:193
eth1:4 Link encap:Ethernet HWaddr 00:0E:A6:0D:BF:4B
inet addr:xxx.xxx.xxx.28 Bcast:xxx.xxx.xxx.31 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:193
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:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)
---------------------------------------------------------------------------------------------
ne' il ping ne' nessun servizio mappato sui due indirizzi ip incriminati
funziona, per esempio, un banale vnc rimappato su un pc nella lan cosi
funziona:
---------------------------------------------------------------------------------------------
iptables -t nat -A PREROUTING -p tcp --dport 5800 -d xxx.xxx.xxx.26 -j DNAT --to-destination 192.168.22.35
iptables -t nat -A PREROUTING -p tcp --dport 5900 -d xxx.xxx.xxx.26 -j DNAT --to-destination 192.168.22.35
iptables -A FORWARD -p tcp --dport 5800 -d 192.168.22.35 -j ACCEPT
iptables -A FORWARD -p tcp --dport 5900 -d 192.168.22.35 -j ACCEPT
iptables -A FORWARD -s 192.168.22.35 -m state --state ESTABLISHED,RELATED -j ACCEPT
---------------------------------------------------------------------------------------------
cosi no.
---------------------------------------------------------------------------------------------
iptables -t nat -A PREROUTING -p tcp --dport 5800 -d xxx.xxx.xxx.27 -j DNAT --to-destination 192.168.22.35
iptables -t nat -A PREROUTING -p tcp --dport 5900 -d xxx.xxx.xxx.27 -j DNAT --to-destination 192.168.22.35
iptables -A FORWARD -p tcp --dport 5800 -d 192.168.22.35 -j ACCEPT
iptables -A FORWARD -p tcp --dport 5900 -d 192.168.22.35 -j ACCEPT
iptables -A FORWARD -s 192.168.22.35 -m state --state ESTABLISHED,RELATED -j ACCEPT
---------------------------------------------------------------------------------------------
la creazione delle interfaccie virtuali la faccio con uno script all'avvio:
---------------------------------------------------------------------------------------------
minimale:/etc/init.d# cat startup.sh
ifconfig eth1:1 xxx.xxx.xxx.29 netmask 255.255.255.248 broadcast xxx.xxx.xxx.31 up
ifconfig eth1:2 xxx.xxx.xxx.30 netmask 255.255.255.248 broadcast xxx.xxx.xxx.31 up
ifconfig eth1:3 xxx.xxx.xxx.27 netmask 255.255.255.248 broadcast xxx.xxx.xxx.31 up
ifconfig eth1:4 xxx.xxx.xxx.28 netmask 255.255.255.248 broadcast xxx.xxx.xxx.31 up
route add default gw xxx.xxx.xxx.25
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.22.1
echo 1 > /proc/sys/net/ipv4/ip_forward
route del -net 0/0 gw 192.168.22.1
---------------------------------------------------------------------------------------------
e' qualcosa che faccio io, ma non riesco a capire cosa, perche' lo
stesso problema l'ho anche su una woody che installai tempo fa'...
ho anche iptables configurato, ma se non lo configuro e lascio tutto
ACCEPT e' lo stesso...
se attribuisco uno dei due indirizzi che non vanno alla scehda fisica
eth1 allora tutto funziona...
qualcuno mi suggerisce qualche altro modo per configurare gli ip
virtuali ??? ci sto' uscendo pazzo
--
LoSpippolo <lospippolo@gmail.com>
Un uomo e' un critico quando non puo' essere un artista.
Reply to: