저는 CentOS 6.5 64를 사용하고 있으며 xen을 사용하여 가상 머신(CentOS)을 생성하고 있습니다.
구성된 경우
[root@CentOS ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:54:B3:FA
inet6 addr: fe80::a00:27ff:fe54:b3fa/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10087 errors:0 dropped:0 overruns:0 frame:0
TX packets:6094 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:763616 (745.7 KiB) TX bytes:541789 (529.0 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:65536 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX bytes:560 (560.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 MULTICAST MTU:1500 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:3969 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:2088 (2.0 KiB) TX bytes:267825 (261.5 KiB)
xenbr0 Link encap:Ethernet HWaddr 08:00:27:54:B3:FA
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe54:b3fa/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9896 errors:0 dropped:0 overruns:0 frame:0
TX packets:1892 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:613149 (598.7 KiB) TX bytes:284945 (278.2 KiB)
brctl표시
[root@CentOS ~]# brctl show
bridge name bridge id STP enabled interfaces
xenbr0 8000.08002754b3fa yes eth0
vif2.0
xl 네트워크 목록
[root@CentOS ~]# xl network-list xc
Idx BE Mac Addr. handle state evt-ch tx-/rx-ring-ref BE-path
0 0 00:16:3e:22:4f:4b 0 4 10 768/769 /local/domain/0/backend/vif/2/0
brctl 쇼맥 xenbr0
[root@CentOS ~]# brctl showmacs xenbr0
port no mac addr is local? ageing timer
2 00:16:3e:22:4f:4b no 89.35
1 00:1e:8c:19:62:67 no 0.00
1 00:22:6b:fe:b9:36 no 4.92
1 08:00:27:54:b3:fa yes 0.00
1 90:c1:15:c4:89:6d no 25.00
1 e0:2a:82:3d:c0:c5 no 3.78
2 fe:ff:ff:ff:ff:ff yes 0.00
평평한
동일한 호스트에서 가상 머신을 ping합니다.
[root@CentOS ~]# ping 192.168.1.120
PING 192.168.1.120 (192.168.1.120) 56(84) bytes of data.
64 bytes from 192.168.1.120: icmp_seq=1 ttl=64 time=2.78 ms
64 bytes from 192.168.1.120: icmp_seq=2 ttl=64 time=0.916 ms
64 bytes from 192.168.1.120: icmp_seq=3 ttl=64 time=0.917 ms
^C
--- 192.168.1.120 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2370ms
rtt min/avg/max/mdev = 0.916/1.538/2.782/0.879 ms
로컬 네트워크의 장치에서 가상 머신 ping
C:\Users\motaz>ping 192.168.1.120
Pinging 192.168.1.120 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
iptables
[root@CentOS ~]# iptables -L -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
11 700 ACCEPT all -- any any anywhere anywhere state RELATED,ESTABLISHED
0 0 ACCEPT icmp -- any any anywhere anywhere
0 0 ACCEPT all -- lo any anywhere anywhere
0 0 ACCEPT tcp -- any any anywhere anywhere state NEW tcp dpt:ssh
0 0 REJECT all -- any any anywhere anywhere reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any any anywhere anywhere PHYSDEV match --physdev-is-bridged
0 0 REJECT all -- any any anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT 8 packets, 864 bytes)
pkts bytes target prot opt in out source destination
누구든지 나에게 이 문제를 해결할 수 있는 아이디어를 줄 수 있다면 매우 감사하겠습니다.
brctl 쇼 stp xenbr0
[root@CentOS images]# brctl showstp xenbr0
xenbr0
bridge id 8000.080027798267
designated root 8000.080027798267
root port 0 path cost 0
max age 20.00 bridge max age 20.00
hello time 2.00 bridge hello time 2.00
forward delay 2.00 bridge forward delay 2.00
ageing time 300.00
hello timer 0.65 tcn timer 0.00
topology change timer 0.00 gc timer 109.38
hash elasticity 4 hash max 512
mc last member count 2 mc init query count 2
mc router 1 mc snooping 1
mc last member timer 1.00 mc membership timer 260.00
mc querier timer 255.00 mc query interval 125.00
mc response interval 10.00 mc init query interval 31.25
flags
eth0 (0)
port id 0000 state forwarding
designated root 8000.080027798267 path cost 4
designated bridge 8000.080027798267 message age timer 0.00
designated port 8001 forward delay timer 0.00
designated cost 0 hold timer 0.00
mc router 1
flags
답변1
먼저 VirtualBox를 사용하여 XEN 서버를 호스팅하는 경우 무선이 아닌 이더넷을 사용하고 있는지 확인하고 무차별 모드를 "모두 허용"으로 설정하십시오.
둘째, 모든 것을 깔끔하게 만들기 위해 XEN을 사용하여 CentOS를 새로 설치하고 여기에 Bridge Network 및 CentOS VM을 설치해 보겠습니다.
외부 서버 192.168.1.6이 있다고 가정하고 /var/www/html/centos/6.3/os/i386/ 및 /var/www/html/centos/6.3/os/i386/ks에서 CentOS ISO를 추출했습니다. 파일은 cfg에서 추출되었으며 /var/www/html/centos/6.3/os/i386/repodata에는 repodata/TRANS.TBL 파일의 이름과 일치하는 올바른 이름이 있습니다.
XEN 서버(CentOS+XEN)에 다음 패키지를 설치합니다.
yum install -y rsync wget vim-enhanced openssh-clients
yum install -y libvirt python-virtinst libvirt-daemon-xen
yum install -y bridge-utils tunctl
그런 다음 ifcfg-* 파일을 편집하여 브리지를 만듭니다.
echo "DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes" > /etc/sysconfig/network-scripts/ifcfg-br0
echo "DEVICE=eth0
HWADDR=XX:XX:XX:XX:XX:XX
ONBOOT=yes
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
BRIDGE=br0" > /etc/sysconfig/network-scripts/ifcfg-eth0
HWADDR=XX:XX:XX:XX:XX:XX
MAC 주소와 일치하도록 행을 편집하십시오 . SSH 콘솔에서 재부팅하지 말고 VBox 콘솔을 사용하십시오.
reboot
다시 시작한 후 DHCP 서버가 있다고 가정하면 XEN 서버는 새 IP를 얻고 VBox 콘솔을 통해 로그인하여 새 IP를 얻습니다.
ifconfig 결과는 다음과 같아야 합니다.
br0 Link encap:Ethernet HWaddr 08:00:27:23:54:69
inet addr:192.168.1.105 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe23:5469/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5063 errors:0 dropped:0 overruns:0 frame:0
TX packets:3142 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:34251267 (32.6 MiB) TX bytes:361205 (352.7 KiB)
eth0 Link encap:Ethernet HWaddr 08:00:27:23:54:69
inet6 addr: fe80::a00:27ff:fe23:5469/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:149910 errors:0 dropped:0 overruns:0 frame:0
TX packets:5045 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:182020057 (173.5 MiB) TX bytes:493792 (482.2 KiB)
이제 브리지가 준비되었으므로 br0의 IP를 사용하여 SSH 콘솔을 다시 가져올 수 있습니다.
이전 브리지를 사용하는 XEN에 가상 머신을 생성하려면:
cd /var/lib/xen/images/
가상 디스크를 생성합니다:
dd if=/dev/zero of=centos_1.img bs=4K count=0 seek=1024K
qemu-img create -f raw centos_1.img 8G
그런 다음 virt-install을 사용하여 가상 머신을 만듭니다.
virt-install -d -n TestVM1 -r 512 --vcpus=1 \
--bridge=br0 --disk /var/lib/xen/images/centos_1.img \
--nographics -p -l "http://192.168.1.6/centos/6.3/os/i386" \
--extra-args="text console=com1 utf8 console=hvc0 ks=http://192.168.1.6/centos/6.3/os/i386/ks.cfg"
이제 가상 머신이 시작되고 DHCP 서버에서 정상적으로 IP를 얻을 수 있으며 무인 원격 설치를 완료할 수 있습니다.
XEN에서 ifconfig의 결과는 다음과 유사해야 합니다.
br0 Link encap:Ethernet HWaddr 08:00:27:23:54:69
inet addr:192.168.1.105 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe23:5469/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10247 errors:0 dropped:0 overruns:0 frame:0
TX packets:8090 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:102264338 (97.5 MiB) TX bytes:827859 (808.4 KiB)
eth0 Link encap:Ethernet HWaddr 08:00:27:23:54:69
inet6 addr: fe80::a00:27ff:fe23:5469/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:998780 errors:0 dropped:0 overruns:0 frame:0
TX packets:37992 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:724701715 (691.1 MiB) TX bytes:2897912 (2.7 MiB)
vif5.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:37 errors:0 dropped:0 overruns:0 frame:0
TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:4381 (4.2 KiB) TX bytes:9842 (9.6 KiB)
일단 설치되면 xen 콘솔을 사용하여 IP를 얻은 다음 SSH 콘솔을 사용할 수 있습니다.