I have a CentOS dedicated server (Hetzner):
IP: aa.bb.cc.16
Gateway: aa.bb.cc.1
Netmask: 255.255.255.255
and additional IP (guest VM (libvirt) with Debian installed):
IP: aa.bb.cc.61
Gateway: aa.bb.cc.1
Netmask: 255.255.255.192
I have setup a routed configuration with Hetzner documentation (https://wiki.hetzner.de/index.php/Netzkonfiguration_CentOS/en#Routed_.28brouter.29).
Host config:
cat /etc/sysctl.conf
net.ipv4.conf.all.rp_filter=1
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
net.ipv4.conf.default.proxy_arp=1
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.eth0.send_redirects=0
net.ipv4.conf.br0.send_redirects=0
net.ipv4.conf.default.send_redirects=0
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
HWADDR=XX:XX:XX:XX:XX:XX
BOOTPROTO=none
IPADDR=aa.bb.cc.16
NETMASK=255.255.255.255
SCOPE="peer aa.bb.cc.1"
IPV6INIT=yes
IPV6ADDR=2a01:4f8:yyy:yyyy::2/128
IPV6_DEFAULTGW=fe80::1
IPV6_DEFAULTDEV=eth0
cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
ONBOOT=yes
TYPE="Bridge"
BOOTPROTO=static
IPADDR=aa.bb.cc.16
NETMASK=255.255.255.255
IPV6INIT=yes
IPV6ADDR=2a01:4f8:yyy:yyyy::2/64
STP=off
DELAY=0
cat /etc/sysconfig/network-scripts/route-br0
ADDRESS0=aa.bb.cc.61
NETMASK0=255.255.255.255
Guest config:
cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address aa.bb.cc.61
netmask 255.255.255.255
pointopoint aa.bb.cc.16
gateway aa.bb.cc.16
dns-nameservers 212.133.98.98 212.133.99.99 212.133.100.100
iface eth0 inet6 static
address 2a01:4f8:yyy:yyyy::4
netmask 64
address 2a01:4f8:yyy:yyyy::2
For internet access from guest VM to internet I have added a rule:
iptables -t nat -A POSTROUTING -o eth0 -s aa.bb.cc.61 -j SNAT --to-source aa.bb.cc.16
Question: It is possible to access from internet to guest VM via guest IP aa.bb.cc.61 in the routed mode? When I pinging from outside (internet) to aa.bb.cc.61 I get 'Request timed out'. But aa.bb.cc.16 (host) pinging ok. What rule I have to add?
Thank you.