So, weiter gehts :-D
Ich habe es mit NAT versucht und kann die domUs nun von außen über beide IPs erreichen, da ich in der dom0 ein Alias-IP ála eth0:1 angelegt habe.
Meine Konfig dazu sieht so aus:
dom0:
cat /etc/network/interfaces
Code: Select all
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
#2.Ip-Adresse
auto eth0:1
iface eth0:1 inet static
address 87.65.43.21
netmask 255.255.255.255
network 87.65.43.21
broadcast 87.65.43.255
gateway 88.88.88.88
ifconfig
Code: Select all
eth0 Protokoll:Ethernet Hardware Adresse 00:1B:00:00:00:00
inet Adresse:12.34.56.78 Bcast:12.34.56.78 Maske:255.255.255.255
inet6 Adresse: fe80::21b:21ff:fe14:8e59/64 Gültigkeitsbereich:Verbindung
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:791 errors:0 dropped:0 overruns:0 frame:0
TX packets:640 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:100
RX bytes:73543 (71.8 KiB) TX bytes:86952 (84.9 KiB)
Basisadresse:0x9000 Speicher:f2020000-f2040000
eth0:1 Protokoll:Ethernet Hardware Adresse 00:1B:00:00:00:00
inet Adresse:87.65.43.21 Bcast:87.65.43.255 Maske:255.255.255.255
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
Basisadresse:0x9000 Speicher:f2020000-f2040000
lo Protokoll:Lokale Schleife
inet Adresse:127.0.0.1 Maske:255.0.0.0
inet6 Adresse: ::1/128 Gültigkeitsbereich:Maschine
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
vif1.0 Protokoll:Ethernet Hardware Adresse FE:FF:FF:FF:FF:FF
inet Adresse:192.168.4.137 Bcast:0.0.0.0 Maske:255.255.255.255
inet6 Adresse: fe80::fcff:ffff:feff:ffff/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:0
RX bytes:1026 (1.0 KiB) TX bytes:1381 (1.3 KiB)
route -n
Code: Select all
Kernel IP Routentabelle
Ziel Router Genmask Flags Metric Ref Use Iface
192.168.4.10 0.0.0.0 255.255.255.255 UH 0 0 0 vif1.0
88.88.88.88 12.34.56.78 255.255.255.255 UGH 0 0 0 eth0
12.34.56.78 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
0.0.0.0 88.88.88.88 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 88.88.88.88 0.0.0.0 UG 0 0 0 eth0
arp und so:
Code: Select all
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/conf/eth0/proxy_arp
iptables:
Code: Select all
iptables -t nat -A PREROUTING -i eth0 -p TCP --dport 80 -j DNAT --to-destination 192.168.4.10:80
domU:
cat /etc/network/interfaces
Code: Select all
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.4.10
gateway 192.168.4.137
netmask 255.255.255.0
ifconfig
Code: Select all
eth0 Link encap:Ethernet HWaddr 00:16:3E:4E:10:3D
inet addr:192.168.4.10 Bcast:192.168.4.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fe4e:103d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15 errors:0 dropped:0 overruns:0 frame:0
TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1381 (1.3 KiB) TX bytes:1264 (1.2 KiB)
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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
route -n
Code: Select all
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.4.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.4.137 0.0.0.0 UG 0 0 0 eth0
Problem: ob ich bei dieser Konfiguration eine oder zwei Adressen habe, ist egal, die zweite ist ja nur ein Alias und liegt sozusagen brach.
Dann bleibt Dir wohl nix anderes übrig als NAT
Nicht besser Routing-Modus?
Das
hier bzw. das
hier ist genau was ich suche. Leider klappt es nicht, beim Starten der domU kommt:
Code: Select all
Setting up networking....
Configuring network interfaces...SIOCADDRT: Network is unreachable
Failed to bring up eth0.
Ich habe dazu wie angegeben die /etc/network/interfaces "normal" aufgesetzt:
Code: Select all
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
xen auf route umgestellt
Code: Select all
(network-script network-route)
(vif-script vif-route)
in /etc/xen/scripts/network-route steht bei mir das hier drin:
Code: Select all
echo 1 >/proc/sys/net/ipv4/ip_forward
echo 1 >/proc/sys/net/ipv4/conf/eth0/proxy_arp
und schließlich in der domU:
Code: Select all
# The primary network interface
auto eth0
iface eth0 inet static
address 87.65.43.21
netmask 255.255.255.255
up /sbin/route add default dev eth0
up /sbin/route add default gw 88.88.88.88
- Hast Du denn IP forwarding und Proxy Arp per sysctl aktiviert?
ja, s.o.
- Wie sehen deine Routing-Tabelle und die NAT-Tabelle von iptables aus?
route -n
Code: Select all
Kernel IP Routentabelle
Ziel Router Genmask Flags Metric Ref Use Iface
88.88.88.88 12.34.56.78 255.255.255.255 UGH 0 0 0 eth0
12.34.56.78 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
0.0.0.0 88.88.88.88 0.0.0.0 UG 0 0 0 eth0
iptables -t nat -L -n (ist noch von der NAT-Variante)
Code: Select all
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE 0 -- 10.0.1.0/24 0.0.0.0/0
MASQUERADE 0 -- 10.0.1.0/24 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
- wie sieht die Netzwerk-Konfiguration innerhalb der DomU aus, wie die dazugehörige Xen-Konfiguration?
s.o. und:
Code: Select all
kernel = '/boot/vmlinuz-2.6.18-6-xen-686'
ramdisk = '/boot/initrd.img-2.6.18-6-xen-686'
memory = '128'
root = '/dev/sda1 ro'
disk = [ 'phy:vg/test5-disk,sda1,w', 'phy:vg/test5-swap,sda2,w' ]
name = 'test5'
vif = [ 'ip=87.65.43.21' ]
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart
Gruß
Thilo