lxc-webpanel / LXC-Web-Panel

LXC Web Panel repository
http://lxc-webpanel.github.io/
MIT License
574 stars 206 forks source link

Not expected address assignee for containers #95

Closed chief93 closed 8 years ago

chief93 commented 8 years ago

Hello I discovered that if IP address is set in container settings, and if connection arch is bridge to external IP network served by DHCP (for example, sharing range of external IPs in LXC), then container after start will have 2 addresses: one static from settings with /8 network and one from DHCP with served network (for example /24). This will cause errors in network discovering (many No route to host errors in terminal). For example, static IP from settings is 192.168.1.30 will result in next # ip addr output:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
        valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
        valid_lft forever preferred_lft forever
12: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:16:3e:ab:d3:57 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.30/8 brd 192.255.255.255 scope global eth0
        valid_lft forever preferred_lft forever
    inet 192.168.1.51/24 brd 192.168.1.255 scope global eth0
        valid_lft forever preferred_lft forever
    inet6 fe80::216:3eff:feab:d357/64 scope link
        valid_lft forever preferred_lft forever

This will cause problems with accesing IPs, which first octet is simillar with /8 first octet (for example *.github.com)

Not sure if this is LWP problem itself, but I think will be usefull to mention user that setting the IP without subnet mask will cause problems. Anyway, setting IP through LXC container settings will not stop router from assignee another IP to that host. In other words, even you set IP like 192.168.1.30/24, router (for example Mikrotik) will add another address, like 192.168.1.51

Solution is simple: leaving empty IP address field in settings and static assignee of expected address in router dashboard. Suggest addition of some kind of option for correct bridging in LWP, for example, select control with UI logic of network type selection.