I have installed a centos 6.5.
I have installed a host hypervisor, libvirt (kvm-qemu) managed with virt-manager I have installed two VMs (with kvm), centos 6.5 each one, too. e.g. centos65_1 and centos65_2 respectively.
The first one centos65_1 uses the default virtual network (NAT)
name: default
device: virbr0
state: active
autoboot: yes
ipv4 configuration
net: 192.168.122.0/24
dhcp:
start: 192.168.122.2
end: 192.168.122.254
forward: NAT
The second one centos65_2 uses a another one virtual network that I have created (a routed network)
name: routed_network
device: virbr1
state: active
autoboot: yes
ipv4 configuration
net: 192.168.100.0/24
dhcp:
start: 192.168.100.128
end: 192.168.100.254
forward: Routed
HOST:
ifconfig when both vms are running
[root@isis jvr]# ifconfig
Auto_eth0 Link encap:Ethernet HWaddr 20:CF:30:AE:65:47
inet addr:192.168.1.15 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::22cf:30ff:feae:6547/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:35 errors:0 dropped:0 overruns:0 frame:0
TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19218 (18.7 KiB) TX bytes:2888 (2.8 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:4958 errors:0 dropped:0 overruns:0 frame:0
TX packets:4958 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1546831 (1.4 MiB) TX bytes:1546831 (1.4 MiB)
virbr0 Link encap:Ethernet HWaddr 52:54:00:96:45:DE
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:31 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1886 (1.8 KiB) TX bytes:1344 (1.3 KiB)
virbr1 Link encap:Ethernet HWaddr 52:54:00:2C:02:F9
inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1774 (1.7 KiB) TX bytes:1204 (1.1 KiB)
vnet0 Link encap:Ethernet HWaddr FE:54:00:77:ED:C8
inet6 addr: fe80::fc54:ff:fe77:edc8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:31 errors:0 dropped:0 overruns:0 frame:0
TX packets:194 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:2320 (2.2 KiB) TX bytes:10756 (10.5 KiB)
vnet1 Link encap:Ethernet HWaddr FE:54:00:A2:8D:8B
inet6 addr: fe80::fc54:ff:fea2:8d8b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29 errors:0 dropped:0 overruns:0 frame:0
TX packets:148 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:2180 (2.1 KiB) TX bytes:8328 (8.1 KiB)
[root@isis jvr]# iptables -v -n -L --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 ACCEPT udp -- virbr1 * 0.0.0.0/0 0.0.0.0/0 udp dpt:53
2 0 0 ACCEPT tcp -- virbr1 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
3 0 0 ACCEPT udp -- virbr1 * 0.0.0.0/0 0.0.0.0/0 udp dpt:67
4 0 0 ACCEPT tcp -- virbr1 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:67
5 0 0 ACCEPT udp -- virbr0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:53
6 0 0 ACCEPT tcp -- virbr0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
7 0 0 ACCEPT udp -- virbr0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:67
8 0 0 ACCEPT tcp -- virbr0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:67
9 4997 1566K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
10 4 336 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
11 4 240 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
12 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
13 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5900
14 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5903
15 10 572 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 6 504 ACCEPT all -- * virbr1 0.0.0.0/0 192.168.100.0/24
2 6 504 ACCEPT all -- virbr1 * 192.168.100.0/24 0.0.0.0/0
3 0 0 ACCEPT all -- virbr1 virbr1 0.0.0.0/0 0.0.0.0/0
4 0 0 REJECT all -- * virbr1 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
5 0 0 REJECT all -- virbr1 * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
6 0 0 ACCEPT all -- * virbr0 0.0.0.0/0 192.168.122.0/24 state RELATED,ESTABLISHED
7 0 0 ACCEPT all -- virbr0 * 192.168.122.0/24 0.0.0.0/0
8 0 0 ACCEPT all -- virbr0 virbr0 0.0.0.0/0 0.0.0.0/0
9 0 0 REJECT all -- * virbr0 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
10 0 0 REJECT all -- virbr0 * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
11 0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT 5015 packets, 1551K bytes)
num pkts bytes target prot opt in out source destination
[root@isis jvr]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.0 * 255.255.255.0 U 0 0 0 virbr1
192.168.1.0 * 255.255.255.0 U 1 0 0 Auto_eth0
192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0
default 192.168.1.1 0.0.0.0 UG 0 0 0 Auto_eth0
[root@isis jvr]# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.5254009645de yes virbr0-nic
vnet0
virbr1 8000.5254002c02f9 yes virbr1-nic
vnet1
ping to clients(vms) is working.
CLIENTS(VMs)
centos65_1
it has static ip
nano /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=2b991cfa-4c3f-4619-8073-806710299fef
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.122.5
PREFIX=24
GATEWAY=192.168.122.1
DNS1=192.168.122.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=52:54:00:77:ed:c8
NETMASK=255.255.255.0
USERCTL=no
At centos65_1 ping to the second vm 192.168.100.130, and to 192.168.1.15 and to 192.168.122.1 works. ping to 192.168.1.1 is working ping to google.com it works
NAT mode works.
centos65_2
it has static ip
nano /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=52:54:00:a2:8d:8b
TYPE=Ethernet
UUID=d61375fb-6e4f-4f43-8015-9f7a218e1b39
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
DNS1=192.168.100.1
IPV6INIT=no
USERCTL=no
IPADDR=192.168.100.130
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
At centos65_2 ping to the second vm 192.168.122.5, and to 192.168.1.15 and to 192.168.100.1 works.
ping to 192.168.1.1 is not working ping to google.com is not working Routed Mode is not working
How is it possible I can't go to outside world?
The idea is made the centos host where virt-manager is installed a router+firewall for vms. I thought the new virtual network (routed_network) had made all network stuff.
What I need to do, to routed network works properly? I'm newbie in virtual networking.
I won't use DMZ at my local network, I would like the same network configuration at my local network and the server.
Thank you. Regards.