OpenVZ Forum


Home » International » Russian » Сеть между VE
Re: Сеть между VE [message #7345 is a reply to message #7332] Wed, 11 October 2006 14:11 Go to previous messageGo to previous message
enpx is currently offline  enpx
Messages: 50
Registered: October 2006
Member
Andrey Mirkin wrote on Wed, 11 October 2006 04:41

Если вы создадите пару veth соединений (по одному для каждого VPS), то концы veth находящиеся в VE0 можно объединить при помощи bridga'a. Этот bridge и будет выглядеть как хаб. В него можно будет добавлять новый veth.


Пытаюсь:

[root@m1 ~]# vzctl create 101 --ostemplate altlinux-sisyphus --config vps.basic
Creating VE private area: /var/lib/vz/private/101
Performing postcreate actions
VE private area was created
[root@m1 ~]# vzctl create 102 --ostemplate altlinux-sisyphus --config vps.basic
Creating VE private area: /var/lib/vz/private/102
Performing postcreate actions
VE private area was created

[root@m1 ~]# vzctl set 101 --veth_add veth1,00:12:34:56:78:9A,eth0,00:12:34:56:78:9B --save
Saved parameters for VE 101
[root@m1 ~]# vzctl set 102 --veth_add veth2,00:12:34:56:78:9C,eth0,00:12:34:56:78:9D --save
Saved parameters for VE 102
	
[root@m1 ~]# ip link set veth1 up
[root@m1 ~]# ip link set veth2 up

[root@m1 ~]# brctl addbr br0
[root@m1 ~]# brctl addif br0 veth1
[root@m1 ~]# brctl addif br0 veth2
[root@m1 ~]# brctl show           
bridge name     bridge id               STP enabled     interfaces
br0             8000.00123456789a       no              veth1
                                                        veth2

[root@m1 ~]# vzctl start 101
Starting VE ...
VE is mounted
Setting CPU units: 1000
Processing veth devices
VE start in progress...
[root@m1 ~]# vzctl start 102
Starting VE ...
VE is mounted
Setting CPU units: 1000
Processing veth devices
VE start in progress...

[root@m1 ~]# vzctl exec 101 ip address add 192.168.199.1/24 dev eth0
[root@m1 ~]# vzctl exec 102 ip address add 192.168.199.2/24 dev eth0
[root@m1 ~]# vzctl exec 101 ip link set eth0 up          
[root@m1 ~]# vzctl exec 102 ip link set eth0 up
[root@m1 ~]# vzctl exec 101 ping 192.168.199.2
... никого ...
[root@m1 ~]# vzctl exec 102 ping 192.168.199.1
... тоже никого ...

[root@m1 ~]# vzctl exec 101 ip address
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
3: venet0: <BROADCAST,POINTOPOINT,NOARP,UP> mtu 1500 qdisc noqueue 
    link/void 
    inet 127.0.0.1/32 scope host venet0
5: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue 
    link/ether 00:12:34:56:78:9b brd ff:ff:ff:ff:ff:ff
    inet 192.168.199.1/24 scope global eth0
    inet6 fe80::212:34ff:fe56:789b/64 scope link 
       valid_lft forever preferred_lft forever
[root@m1 ~]# vzctl exec 101 ip route  
192.168.199.0/24 dev eth0  proto kernel  scope link  src 192.168.199.1 
192.0.2.0/24 dev venet0  scope host 
default via 192.0.2.1 dev venet0 
[root@m1 ~]# vzctl exec 102 ip address
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
3: venet0: <BROADCAST,POINTOPOINT,NOARP,UP> mtu 1500 qdisc noqueue 
    link/void 
    inet 127.0.0.1/32 scope host venet0
5: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue 
    link/ether 00:12:34:56:78:9d brd ff:ff:ff:ff:ff:ff
    inet 192.168.199.2/24 scope global eth0
    inet6 fe80::212:34ff:fe56:789d/64 scope link 
       valid_lft forever preferred_lft forever
[root@m1 ~]# vzctl exec 102 ip route  
192.168.199.0/24 dev eth0  proto kernel  scope link  src 192.168.199.2 
192.0.2.0/24 dev venet0  scope host 
default via 192.0.2.1 dev venet0 


Что неправильно?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: VE default route
Next Topic: Набор VE : один router/firewall и все остальные за ним
Goto Forum:
  


Current Time: Tue Jul 09 22:22:52 GMT 2024

Total time taken to generate the page: 0.02387 seconds