Saturday 31 May 2014

Connman is annoying

Connman is the new way of doing networking apparently but why fix what isn't broken. I know the talk about 'what if the network falls' blah blah blah but if the network should fail then I'm up the Swanny anyway. A big minus side to connman is it doesn't work well with my wireless network. I don't need wireless really but I would like to make the whole hub fairly portable (just need mains supply) rather than need a network cable.
I don't want connman anywhere near my beaglebone.
How to remove connman and revert to traditional network interface start up.
DISABLE CONNMAN
systemctl disable connman.service

CREATE INTERFACES FILE
cat > /etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
 
auto eth0
iface eth0 inet static
address 192.168.0.99
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1
 
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
gateway 192.168.7.1
dns-nameservers 192.168.7.1
 
iface wlan0 inet static
address 192.168.0.98
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1
wireless_mode managed
wireless_essid “SSID NAME HERE”
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
pre-up wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant
EOF
CREATE RESOLV.CONF
cat >/etc/resolv.conf <<EOF
search local
nameserver 192.168.0.1
EOF
CREATE WPA_SUPPLICANT.CONF WITH PASS
cat >/etc/wpa_supplicant.conf <<EOF
ap_scan=2

network={
ssid="VM275247-2G"
proto=WPA RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk=long key for psk
}
EOF

CREATE SERVICE FOR WIFI
cat >/etc/systemd/system/net.service <<EOF
[Unit]
Description=Network interfaces
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-wlan0.device
After=sys-subsystem-net-devices-wlan0.device

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c "sleep 5;ifup wlan0"
ExecStop=/bin/sh -c "ifdown wlan0"

[Install]
WantedBy=multi-user.target
EOF
START SERVICE
systemctl enable net.service
Obviously you need to enter your own details :)

4 comments:

  1. Thanks, this really helps out.

    ReplyDelete
  2. Not works because connman overwrite resolv.conf at startup with he's own link!

    ReplyDelete
  3. Its great if you can get booted up before connman screws up the boot. If you're NFS booting, you won't be able to get far enough to disable connman this way. Instead, you'll have to take it out of /etc/init.d and /lib/systemd/system (I think that's right). Otherwise connman just starts up, screws up your dhcp'd NFS connection and hoses up your boot.

    ReplyDelete
  4. Install the dhcpcd5 package first if you need a dynamic IP.

    ReplyDelete