network


How to List all Docker Container Names and their IPs 4

The following command will make a list with all docker container names and their respective IPs.
For the containers that have multiple IPs it will printed them on the same row as their name.


docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }} {{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' | sed 's#^/##';


Qubes OS: Connect to Wi-Fi or Ethernet or another network 1

A couple of days ago we decided to give Qubes OS a go and see what it could do for a regular user. The installation was easy as it uses the same installer as Fedora, so we just created a live USB and formatted a laptop that had built in Wi-Fi.

To our surprise, we could not figure out how to change the network settings and activate an internet connection! Going to the NetworkManager (nm), even with root, would show us all fields as disabled when trying to create any new connection!

Some time passed before we realized that the NetworkManager of XFCE4 was not the way to go. After inspecting the Virtual Machines on the Qubes VM Manager, we saw that the sys-net VM was the only one that had in its hardware settings to access the Ethernet and Wi-Fi modules. So we got the hint, we needed to modify sys-net in order to connect the entire OS with its VMs to the network.

To modify the settings of the sys-net VM we needed access to the Settings Application, which was not available in the application menu. So the first thing we did, was to use the sys-net: Add more shortcuts... option under the group ServiceVM: sys-net to enable the Settings application shortcut.

In the [Dom0] Settings: sys-net window, we went to the Applications tab, on the left list we scrolled down to find the Settings option.

After selecting the Settings option, we clicked on the > button to move the Settings option to the right list.

Then we clicked on the OK button to apply the changes.

Going back to the application menu and the group ServiceVM: sys-net we could see the new option for sys-net: Settings.

Clicking on the sys-net: Settings showed us the usual settings manager for Gnome.

From there on, our job was easy, we just clicked on the Network option that gave us the window to modify all network settings. Then we selected the Wi-Fi network that we wanted to connect to, which worked without a hitch!

Finally, we had to test if the configuration was working as expected. From the application menu, under the group Domain: personal, we selected the option personal: Firefox to start the Firefox application on the personal VM.

Once Firefox started we could see that internet connection was active and everything was working as expected!


KVM: How to configure a bridge connection in Ubuntu 11.10 2

Make the file : /etc/network/interfaces  look something like this (make changes only to br0, add it if not there and to the device that you want to bridge with, we used eth1):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet dhcp

# Building a bridge to be used by the Virtual Machines
auto br0
iface br0 inet static
        address 192.168.0.10
        network 192.168.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        bridge_ports eth1
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off

Then issue: sudo /etc/init.d/networking restart
If you get:

* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
 * Reconfiguring network interfaces...                                                                                                                                                    RTNETLINK answers: File exists
ssh stop/waiting
ssh start/running, process 11489

Waiting for br0 to get ready (MAXWAIT is 20 seconds).
RTNETLINK answers: File exists
Failed to bring up br0.                        [ OK ]

Try bringing down the device to be bridged (eth1) like this: sudo  ifdown eth1 and then issue sudo /etc/init.d/networking restart again.
After that enable it the device again again like this: sudo  ifup eth1
If this doesn’t worked try restarting the machine, worked for us.

When properly configured ifconfig should result to something similar as this:

br0       Link encap:Ethernet  HWaddr 00:1a:64:67:d3:86  
          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:64ff:fe67:d386/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1752 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:136973 (136.9 KB)  TX bytes:1500 (1.5 KB)

eth0      Link encap:Ethernet  HWaddr 00:1a:64:67:d3:84  
          inet addr:10.16.20.60  Bcast:10.16.20.63  Mask:255.255.255.224
          inet6 addr: fe80::21a:64ff:fe67:d384/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:91218 errors:0 dropped:0 overruns:0 frame:0
          TX packets:51796 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:123551183 (123.5 MB)  TX bytes:4754458 (4.7 MB)
          Interrupt:16 Memory:ce000000-ce012800

eth1      Link encap:Ethernet  HWaddr 00:1a:64:67:d3:86  
          inet addr:10.16.20.33  Bcast:10.16.20.63  Mask:255.255.255.224
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:2605 errors:0 dropped:48 overruns:0 frame:0
          TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:321878 (321.8 KB)  TX bytes:3490 (3.4 KB)
          Interrupt:17 Memory:ca000000-ca012800

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:129 errors:0 dropped:0 overruns:0 frame:0
          TX packets:129 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:17588 (17.5 KB)  TX bytes:17588 (17.5 KB)

virbr0    Link encap:Ethernet  HWaddr b6:ae:8d:e0:06:c3  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)