This time no libvirt.
This is the situation:
Router (Fritz Box 7490) connected to internet via dsl, Router has ip 192.168.0.1
Nas (192.168.0.3 bare metal) connected to Router
Http server (lxc container) on nas
My idea is to create a dmz (192.168.179.0/24) which can be reached from internet but cannot reach the lan (192.168.0.0/24). I know the lxc container is not 100% isolated, but is unprivileged, I hope is safe.
On Router I have configured the dmz in this way
/etc/config/network
config device
option type '8021q'
option ifname 'lan3'
option vid '1'
option name 'lan3.1'
config interface 'dmz'
option proto 'static'
option device 'lan3.1'
option ipaddr '192.168.179.1'
option netmask '255.255.255.0'
of course lan3 is removed from the bridge
this is the firewall configuration, I want lan can reach dmz but not dmz reach lan
config zone
option name 'dmz'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
list device 'lan3.1'
config forwarding
option src 'lan'
option dest 'dmz'
config forwarding
option src 'dmz'
option dest 'wan'
I restart the network and I can see the ip is pingable from lan (192.168.0.0/24)
ping 192.168.179.1
PING 192.168.179.1 (192.168.179.1) 56(84) bytes of data.
64 bytes from 192.168.179.1: icmp_seq=1 ttl=64 time=5.56 ms
64 bytes from 192.168.179.1: icmp_seq=2 ttl=64 time=6.15 ms
Now I go to Nas (192.168.0.3) and I create the bridge and vlan interface
iface enp7s0.1 inet manual
auto br1.1
iface br1.1 inet manual
bridge_ports enp7s0.1
bridge_fd 0
bridge_maxwait 0
I put the network up
ifup enp7s0.1
ifup br1.1
Then I configure the lxc part
/etc/lxc/lxc-usernet
lxcunpriv veth br1.1 40
I configure the container using the vlan bridge
# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = br1.1
lxc.net.0.flags = up
lxc.net.0.hwaddr = SECRET
lxc.net.0.name = eth0
I start the container and ... nothing work.
On container I use the ip 192.168.179.2
eth0@if25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether ********** brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.179.2/24 scope global eth0
valid_lft forever preferred_lft forever
inet6 *******/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
The container is isolated and alone, cannot ping internet, cannot ping lan
[root@http ~]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.179.2 icmp_seq=1 Destination Host Unreachable
From 192.168.179.2 icmp_seq=2 Destination Host Unreachable
From 192.168.179.2 icmp_seq=3 Destination Host Unreachable
From 192.168.179.2 icmp_seq=4 Destination Host Unreachable
From 192.168.179.2 icmp_seq=5 Destination Host Unreachable
From 192.168.179.2 icmp_seq=6 Destination Host Unreachable
From 192.168.179.2 icmp_seq=7 Destination Host Unreachable
From 192.168.179.2 icmp_seq=8 Destination Host Unreachable
From 192.168.179.2 icmp_seq=9 Destination Host Unreachable
From 192.168.179.2 icmp_seq=10 Destination Host Unreachable
--- 8.8.8.8 ping statistics ---
13 packets transmitted, 0 received, +10 errors, 100% packet loss, time 12273ms
pipe 4
[root@http ~]# ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
From 192.168.179.2 icmp_seq=1 Destination Host Unreachable
From 192.168.179.2 icmp_seq=2 Destination Host Unreachable
From 192.168.179.2 icmp_seq=3 Destination Host Unreachable
--- 192.168.0.1 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3052ms
pipe 4
[root@http ~]# ping 192.168.179.1
PING 192.168.179.1 (192.168.179.1) 56(84) bytes of data.
From 192.168.179.2 icmp_seq=1 Destination Host Unreachable
From 192.168.179.2 icmp_seq=2 Destination Host Unreachable
From 192.168.179.2 icmp_seq=3 Destination Host Unreachable
From 192.168.179.2 icmp_seq=4 Destination Host Unreachable
What I miss? I have to set some nat rules even in the Nas?