hi, i''d like to know if it is possible tto have two networks with two networking card? eth0 : 192.168.1.x --> dom0 + domX eth1 : 192.168.2.x --> domY 192.168.1.x ---> gw 192.168.1.1 192.168.2.x ---> gw 192.168.2.1 are in a different VLAN what''s do you think about that? is it possibleto create this networking with just ONE networking card? thank you in advance for any advice. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Nico Kadel-Garcia
2007-Jun-29 00:31 UTC
Re: [xen-users] two networks with two networking cards...?
ko0nz wrote:> hi, > > i''d like to know if it is possible tto have two networks with two > networking card? > eth0 : 192.168.1.x --> dom0 + domX > eth1 : 192.168.2.x --> domY > > 192.168.1.x ---> gw 192.168.1.1 > 192.168.2.x ---> gw 192.168.2.1 > are in a different VLAN > > what''s do you think about that? > is it possibleto create this networking with just ONE networking card? > > thank you in advance for any advice.I assume your card has multiple physical ports? Or no? And why do you want to do this? It seems feasible, but it''s not something I''ve tried. A gateway is specic to the host''s routing tables, which are on the host, not the NIC. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
> I assume your card has multiple physical ports? Or no? And why do you > want to do this?yes, for the two cards, i have two physical ports. the first network will connected with private local network only. the second network will connected with the DMZ.> It seems feasible, but it''s not something I''ve tried. A gateway is > specic to the host''s routing tables, which are on the host, not the NIC.yes. i understand that. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Nico Kadel-Garcia
2007-Jun-29 10:47 UTC
Re: [xen-users] two networks with two networking cards...?
ko0nz wrote:>> I assume your card has multiple physical ports? Or no? And why do you >> want to do this? > > yes, for the two cards, i have two physical ports. > the first network will connected with private local network only. > the second network will connected with the DMZ. > >> It seems feasible, but it''s not something I''ve tried. A gateway is >> specic to the host''s routing tables, which are on the host, not the NIC. > > yes. i understand that. >Cool. I do wonder *WHY* you have two internal 192.168.x.y with overlapping IP space? Why not have one be 192.168.1.0/24, with a gateway at 192.16.1.1, and the other at 192.168.2.0/24, with its gateway at 192.168.2.1? Merging overlapping networks is begging for reverse DNS trouble, and SSH whining bitterly about it. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Nico Kadel-Garcia
2007-Jun-29 10:57 UTC
Re: [xen-users] two networks with two networking cards...?
ko0nz wrote:>> I assume your card has multiple physical ports? Or no? And why do you >> want to do this? > > yes, for the two cards, i have two physical ports. > the first network will connected with private local network only. > the second network will connected with the DMZ. > >> It seems feasible, but it''s not something I''ve tried. A gateway is >> specic to the host''s routing tables, which are on the host, not the NIC. > > yes. i understand that. >The more I think about this, the more it sounds like a bad idea:. How painful is it for you to change your configurations so that 192.168.1.0/24 is one network, and 192.168.2.0/24 is the other one? Keeping them overlapping just seems to beg for trouble. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
> The more I think about this, the more it sounds like a bad idea:. How > painful is it for you to change your configurations so that > 192.168.1.0/24 is one network, and 192.168.2.0/24 is the other one? > Keeping them overlapping just seems to beg for trouble.yes, in the VLAN, 192.168.1.x and 192.168.2.x are two different networks. my aim is to connect some servers and dom0 are in the VLAN 192.168.1.x with gateway 192.168.1.1 and another one in the 192.168.2.x with gateway 192.168.2.1 really, i''d like that works... _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Petersson, Mats
2007-Jun-29 13:03 UTC
RE: [xen-users] two networks with two networking cards...?
> -----Original Message----- > From: xen-users-bounces@lists.xensource.com > [mailto:xen-users-bounces@lists.xensource.com] On Behalf Of ko0nz > Sent: 29 June 2007 13:53 > To: Nico Kadel-Garcia > Cc: xen-users@lists.xensource.com > Subject: Re: [xen-users] two networks with two networking cards...? > > > The more I think about this, the more it sounds like a bad > idea:. How > > painful is it for you to change your configurations so that > > 192.168.1.0/24 is one network, and 192.168.2.0/24 is the other one? > > Keeping them overlapping just seems to beg for trouble. > > yes, in the VLAN, 192.168.1.x and 192.168.2.x are two > different networks. > my aim is to connect some servers and dom0 are in the VLAN 192.168.1.x > with gateway 192.168.1.1 and another one in the 192.168.2.x with > gateway 192.168.2.1 > > really, i''d like that works...That should work - I don''t see any problem at all, besides the fact that you need to do some configuring in your guest(s). -- Mats> > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users > > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
> > really, i''d like that works... > > That should work - I don''t see any problem at all, besides the fact that > you need to do some configuring in your guest(s).oki ! thank you for your advices. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
it seems it would be possible but i don''t find anything to do the config on the Host and on the Guest... does someone has some intéresting links? thank you in advance. On 6/29/07, ko0nz <yesiko0nz@gmail.com> wrote:> hi, > > i''d like to know if it is possible tto have two networks with two > networking card? > eth0 : 192.168.1.x --> Dom0 + DomX ---> Servers > eth1 : 192.168.2.x --> DomY ----> DMZ > > 192.168.1.x ---> gw 192.168.1.1 > 192.168.2.x ---> gw 192.168.2.1 > are in a different VLAN > > what''s do you think about that? > > > thank you in advance for any advice. >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
here''s how i try to did:
-------------------------------
Dom0 : eth0 --> ip 192.168.1.10
gw 192.168.1.1
eth1 --> ip 192.168.2.20
gw 192.168.2.1
i''d like to have the the host (Dom0) using the eth0 interface with
192.168.1.10 gw 192.168.1.1
and i''d like to have ONE guest (DomU) using the eth1 interface with
192.168.2.200 gw 192.168.2.1
-----------------------------------------------------------------------------------------------------------------------------------------------
on Dom0:
cat /etc/xen/xend-config.sxp
(network-script network-bond-bridge-setup)
(vif-script vif-bridge)
(dom0-min-mem 196)
(dom0-cpus 0)
------
cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto xenbr0
iface xenbr0 inet static
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 172.20.22.255
gateway 192.168.1.1
bridge_ports eth0
# optional
bridge_maxwait 0
auto xenbr1
iface xenbr1 inet static
address 192.168.2.20
netmask 255.255.255.0
network 192.168.1.0
broadcast 172.20.10.255
gateway 192.168.2.1
bridge_ports eth1
# optional
bridge_maxwait 0
------------------
cat /etc/xen/scripts/network-bond-bridge-setup
#!/bin/sh
# Usage: transfer_addrs src dst
# Copy all IP addresses (including aliases) from device $src to device $dst.
transfer_addrs () {
local src=$1
local dst=$2
# Don''t bother if $dst already has IP addresses.
if ip addr show dev ${dst} | egrep -q ''^ *inet '' ; then
return
fi
# Address lines start with ''inet'' and have the device in
them.
# Replace ''inet'' with ''ip addr add'' and
change the device name $src
# to ''dev $src''.
ip addr show dev ${src} | egrep ''^ *inet '' | sed -e "
s/inet/ip addr add/
s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@
s/${src}/dev ${dst}/
" | sh -e
# Remove automatic routes on destination device
ip route list | sed -ne "
/dev ${dst}\( \|$\)/ {
s/^/ip route del /
p
}" | sh -e
}
# Usage: transfer_routes src dst
# Get all IP routes to device $src, delete them, and
# add the same routes to device $dst.
# The original routes have to be deleted, otherwise adding them
# for $dst fails (duplicate routes).
transfer_routes () {
local src=$1
local dst=$2
# List all routes and grep the ones with $src in.
# Stick ''ip route del'' on the front to delete.
# Change $src to $dst and use ''ip route add'' to add.
ip route list | sed -ne "
/dev ${src}\( \|$\)/ {
h
s/^/ip route del /
P
g
s/${src}/${dst}/
s/^/ip route add /
P
d
}" | sh -e
}
# Usage: create_bridge bridge
create_bridge () {
local bridge=$1
# Don''t create the bridge if it already exists.
if ! brctl show | grep -q ${bridge} ; then
brctl addbr ${bridge}
brctl stp ${bridge} off
brctl setfd ${bridge} 0
fi
ip link set ${bridge} up
}
# Usage: add_to_bridge bridge dev
add_to_bridge () {
local bridge=$1
local dev=$2
# Don''t add $dev to $bridge if it''s already on a bridge.
if ! brctl show | grep -q ${dev} ; then
brctl addif ${bridge} ${dev}
fi
}
# Usage: show_status dev bridge
# Print ifconfig and routes.
show_status () {
local dev=$1
local bridge=$2
echo
''============================================================''
ip addr show ${dev}
ip addr show ${bridge}
echo '' ''
brctl show ${bridge}
echo '' ''
ip route list
echo '' ''
route -n
echo
''============================================================''
}
op_start () {
create_bridge xenbr0
#add_to_bridge xenbr0 vif0.0
add_to_bridge2 xenbr0 eth0
#transfer_addrs bond0 xenbr0
#transfer_routes bond0 xenbr0
create_bridge xenbr1
add_to_bridge xenbr1 eth2
ifconfig xenbr1 172.20.0.190 netmask 255.255.255.0 up
route add default gw 172.20.0.1
create_bridge xenbr2
create_bridge xenbr3
}
op_stop () {
transfer_routes xenbr0 eth0
ip link set xenbr0 down
brctl delbr xenbr0
ip link set xenbr1 down
brctl delbr xenbr1
}
# adds $dev to $bridge but waits for $dev to be in running state first
add_to_bridge2() {
local bridge=$1
local dev=$2
local maxtries=10
echo -n "Waiting for ${dev} to negotiate link."
for i in `seq ${maxtries}` ; do
if ifconfig ${dev} | grep -q RUNNING ; then
break
else
echo -n ''.''
sleep 1
fi
done
if [ ${i} -eq ${maxtries} ] ; then echo ''(link isnt in running
state)'' ; fi
add_to_bridge ${bridge} ${dev}
}
case "${1}" in
start)
op_start
;;
stop)
op_stop
;;
status)
show_status ${netdev} ${bridge}
;;
*)
echo "Unknown command: ${1}" >&2
echo ''Valid commands are: start, stop, status''
>&2
exit 1
esac
------------------------------------------------------------------------------------------------------------
on DomU
cat /etc/xen/test0.cfg
#
# Networking
#
vif = [ ''ip=192.168.2.200'' ]
------------------------
cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.200
gateway 192.168.2.1
netmask 255.255.255.0
##########################################################################
what''s i get:
# brctl show
bridge name bridge id STP enabled interfaces
xenbr0 8000.000ffe6df4e5 no eth0
vif2.0
xenbr1 8000.0013f70ba95c no eth1
----------
eth0 Link encap:Ethernet HWaddr 00:0F:FE:6D:F4:E5
inet6 addr: fe80::20f:feff:fe6d:f4e5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12594 errors:0 dropped:0 overruns:0 frame:0
TX packets:1207 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:2212135 (2.1 MiB) TX bytes:173429 (169.3 KiB)
Base address:0x2100 Memory:f0500000-f0520000
eth1 Link encap:Ethernet HWaddr 00:13:F7:0B:A9:5C
inet6 addr: fe80::213:f7ff:fe0b:a95c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25128 errors:0 dropped:0 overruns:0 frame:0
TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9397421 (8.9 MiB) TX bytes:5273 (5.1 KiB)
Interrupt:19 Base address:0xa000
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:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:840 (840.0 b) TX bytes:840 (840.0 b)
vif2.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:235 errors:0 dropped:0 overruns:0 frame:0
TX packets:10049 errors:0 dropped:1 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:13703 (13.3 KiB) TX bytes:1830178 (1.7 MiB)
xenbr0 Link encap:Ethernet HWaddr 00:0F:FE:6D:F4:E5
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20f:feff:fe6d:f4e5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12148 errors:0 dropped:0 overruns:0 frame:0
TX packets:978 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1939726 (1.8 MiB) TX bytes:151682 (148.1 KiB)
xenbr1 Link encap:Ethernet HWaddr 00:13:F7:0B:A9:5C
inet addr:192.168.2.20 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::213:f7ff:fe0b:a95c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:24921 errors:0 dropped:0 overruns:0 frame:0
TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8910868 (8.4 MiB) TX bytes:5015 (4.8 KiB)
--------------------
the problem is that the Dom0 is using the address of eth1 interface:
192.168.2.20.
i''d like it use the the eth0 interface 192.168.1.10.
i can ping work-bond-bridge-setup)
(vif-script vif-bridge)
(dom0-min-mem 196)
(dom0-cpus 0)
------
cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto xenbr0
iface xenbr0 inet static
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 172.20.22.255
gateway 192.168.1.1
bridge_ports eth0
# optional
bridge_maxwait 0
auto xenbr1
iface xenbr1 inet static
address 192.168.2.20
netmask 255.255.255.0
network 192.168.1.0
broadcast 172.20.10.255
gateway 192.168.2.1
bridge_ports eth1
# optional
bridge_maxwait 0
------------------
cat /etc/xen/scripts/network-bond-bridge-setup
#!/bin/sh
# Usage: transfer_addrs src dst
# Copy all IP addresses (including aliases) from device $src to device $dst.
transfer_addrs () {
local src=$1
local dst=$2
# Don''t bother if $dst already has IP addresses.
if ip addr show dev ${dst} | egrep -q ''^ *inet '' ; then
return
fi
# Address lines start with ''inet'' and have the device in
them.
# Replace ''inet'' with ''ip addr add'' and
change the device name $src
# to ''dev $src''.
ip addr show dev ${src} | egrep ''^ *inet '' | sed -e "
s/inet/ip addr add/
s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@
s/${src}/dev ${dst}/
" | sh -e
# Remove automatic routes on destination device
ip route list | sed -ne "
/dev ${dst}\( \|$\)/ {
s/^/ip route del /
p
}" | sh -e
}
# Usage: transfer_routes src dst
# Get all IP routes to device $src, delete them, and
# add the same routes to device $dst.
# The original routes have to be deleted, otherwise adding them
# for $dst fails (duplicate routes).
transfer_routes () {
local src=$1
local dst=$2
# List all routes and grep the ones with $src in.
# Stick ''ip route del'' on the front to delete.
# Change $src to $dst and use ''ip route add'' to add.
ip route list | sed -ne "
/dev ${src}\( \|$\)/ {
h
s/^/ip route del /
P
g
s/${src}/${dst}/
s/^/ip route add /
P
d
}" | sh -e
}
# Usage: create_bridge bridge
create_bridge () {
local bridge=$1
# Don''t create the bridge if it already exists.
if ! brctl show | grep -q ${bridge} ; then
brctl addbr ${bridge}
brctl stp ${bridge} off
brctl setfd ${bridge} 0
fi
ip link set ${bridge} up
}
# Usage: add_to_bridge bridge dev
add_to_bridge () {
local bridge=$1
local dev=$2
# Don''t add $dev to $bridge if it''s already on a bridge.
if ! brctl show | grep -q ${dev} ; then
brctl addif ${bridge} ${dev}
fi
}
# Usage: show_status dev bridge
# Print ifconfig and routes.
show_status () {
local dev=$1
local bridge=$2
echo
''============================================================''
ip addr show ${dev}
ip addr show ${bridge}
echo '' ''
brctl show ${bridge}
echo '' ''
ip route list
echo '' ''
route -n
echo
''============================================================''
}
op_start () {
create_bridge xenbr0
#add_to_bridge xenbr0 vif0.0
add_to_bridge2 xenbr0 eth0
#transfer_addrs bond0 xenbr0
#transfer_routes bond0 xenbr0
create_bridge xenbr1
add_to_bridge xenbr1 eth2
ifconfig xenbr1 172.20.0.190 netmask 255.255.255.0 up
route add default gw 172.20.0.1
create_bridge xenbr2
create_bridge xenbr3
}
op_stop () {
transfer_routes xenbr0 eth0
ip link set xenbr0 down
brctl delbr xenbr0
ip link set xenbr1 down
brctl delbr xenbr1
}
# adds $dev to $bridge but waits for $dev to be in running state first
add_to_bridge2() {
local bridge=$1
local dev=$2
local maxtries=10
echo -n "Waiting for ${dev} to negotiate link."
for i in `seq ${maxtries}` ; do
if ifconfig ${dev} | grep -q RUNNING ; then
break
else
echo -n ''.''
sleep 1
fi
done
if [ ${i} -eq ${maxtries} ] ; then echo ''(link isnt in running
state)'' ; fi
add_to_bridge ${bridge} ${dev}
}
case "${1}" in
start)
op_start
;;
stop)
op_stop
;;
status)
show_status ${netdev} ${bridge}
;;
*)
echo "Unknown command: ${1}" >&2
echo ''Valid commands are: start, stop, status''
>&2
exit 1
esac
------------------------------------------------------------------------------------------------------------
on DomU
cat /etc/xen/test0.cfg
#
# Networking
#
vif = [ ''ip=192.168.2.200'' ]
------------------------
cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.200
gateway 192.168.2.1
netmask 255.255.255.0
##########################################################################
what''s i get:
# brctl show
bridge name bridge id STP enabled interfaces
xenbr0 8000.000ffe6df4e5 no eth0
vif2.0
xenbr1 8000.0013f70ba95c no eth1
----------
eth0 Link encap:Ethernet HWaddr 00:0F:FE:6D:F4:E5
inet6 addr: fe80::20f:feff:fe6d:f4e5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12594 errors:0 dropped:0 overruns:0 frame:0
TX packets:1207 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:2212135 (2.1 MiB) TX bytes:173429 (169.3 KiB)
Base address:0x2100 Memory:f0500000-f0520000
eth1 Link encap:Ethernet HWaddr 00:13:F7:0B:A9:5C
inet6 addr: fe80::213:f7ff:fe0b:a95c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25128 errors:0 dropped:0 overruns:0 frame:0
TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9397421 (8.9 MiB) TX bytes:5273 (5.1 KiB)
Interrupt:19 Base address:0xa000
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:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:840 (840.0 b) TX bytes:840 (840.0 b)
vif2.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:235 errors:0 dropped:0 overruns:0 frame:0
TX packets:10049 errors:0 dropped:1 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:13703 (13.3 KiB) TX bytes:1830178 (1.7 MiB)
xenbr0 Link encap:Ethernet HWaddr 00:0F:FE:6D:F4:E5
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20f:feff:fe6d:f4e5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12148 errors:0 dropped:0 overruns:0 frame:0
TX packets:978 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1939726 (1.8 MiB) TX bytes:151682 (148.1 KiB)
xenbr1 Link encap:Ethernet HWaddr 00:13:F7:0B:A9:5C
inet addr:192.168.2.20 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::213:f7ff:fe0b:a95c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:24921 errors:0 dropped:0 overruns:0 frame:0
TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8910868 (8.4 MiB) TX bytes:5015 (4.8 KiB)
--------------------
the problem is that the Dom0 is using the address of eth0 interface:
192.168.1.10.
i''d like it use the the eth0 interface 192.168.2.20.
i can ping 192.168.1.10, 192.168.2.20
my DomU, test0 is using 192.168.2.200 gw 192.168.2.200 gw 192.168.2.1
and it works fine.
what could you suggest, please?
the script, i get it from someone.
is the config correct?
thank you in adavance.
_______________________________________________
Xen-users mailing list
Xen-users@lists.xensource.com
http://lists.xensource.com/xen-users