You are not logged in.

#1 2013-11-07 23:50:40

AMaudio
Member
From: Ireland
Registered: 2013-11-07
Posts: 14

[SOLVED] Cannot bring wifi interface up

Hello,

A bit of a newbie here...

I've just installed archlinux on a laptop and I'm trying to get it to use a static IP on the wireless (already suceeded to get it working with a static IP on the wired network) via WEP to an access point that doesn't broadcast its ESSID.

I have set up a netctl profile which runs at boot time. Said profile seems to run correctly and I even get an IP address for the wireless. However, it doesn't seem to bring the wifi interface up and typing "ip link set <INTERFACE> up" as root seems to have no effect. I have already installed the firmware for the card and I'm not successful in getting a connection.

This is the output of the commands I've tried so far:

# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    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
2: wlp2s3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether 00:12:f0:02:47:bd brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.6/26 brd 192.168.1.63 scope global wlp2s3
       valid_lft forever preferred_lft forever
3: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:11:43:4b:d6:ec brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.5/26 brd 192.168.1.63 scope global enp2s0
       valid_lft forever preferred_lft forever
    inet6 fe80::211:43ff:fe4b:d6ec/64 scope link 
       valid_lft forever preferred_lft forever

# iw dev
phy#0
	Interface wlp2s3
		ifindex 2
		wdev 0x1
		addr 00:12:f0:02:47:bd
		type managed

# iw dev wlp2s3 link
Not connected.

# ip link set wlp2s3 up
<this command doesn't produce any output>

# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    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
2: wlp2s3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether 00:12:f0:02:47:bd brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.6/26 brd 192.168.1.63 scope global wlp2s3
       valid_lft forever preferred_lft forever
3: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:11:43:4b:d6:ec brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.5/26 brd 192.168.1.63 scope global enp2s0
       valid_lft forever preferred_lft forever
    inet6 fe80::211:43ff:fe4b:d6ec/64 scope link 
       valid_lft forever preferred_lft forever

# iw dev
phy#0
	Interface wlp2s3
		ifindex 2
		wdev 0x1
		addr 00:12:f0:02:47:bd
		type managed

# iw dev wlp2s3 link
Not connected.

# lspci -k
[...]
02:03.0 Network controller: Intel Corporation PRO/Wireless 2200BG [Calexico2] Network Connection (rev 05)
	Subsystem: Intel Corporation Dell Latitude D600
	Kernel driver in use: ipw2200
	Kernel modules: ipw2200

# dmesg | grep ipw2200
[    6.606394] ipw2200: Intel(R) PRO/Wireless 2200/2915 Network Driver, 1.2.2kmprq
[    6.606401] ipw2200: Copyright(c) 2003-2006 Intel Corporation
[    6.608009] ipw2200: Detected Intel PRO/Wireless 2200BG Network Connection
[    6.854658] ipw2200: Detected geography ZZD (13 802.11bg channels, 0 802.11a channels)

# rfkill list
0: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no

As a reference, here you have the netctl profile I created:

Description='WEP encrypted wireless connection'
Interface=wlp2s3
Connection=wireless
Security=wep
ESSID='MYNETWORKNAME'
# Prepend \" to hexadecimal keys
Key=\"01234567890ABCDEF012345678
IP=static
Address=('192.168.1.6/26')
Gateway='192.168.1.XXX'
DNS=('XXX.XXX.XXX.XXX' 'YYY.YYY.YYY.YYY')
SkipNoCarrier=yes

# Uncomment this if your ssid is hidden
Hidden=yes
# Uncomment if you are using an ad-hoc connection
#AdHoc=yes

Thanks in advance for your help/advice!!

Last edited by AMaudio (2013-11-09 21:08:35)

Offline

#2 2013-11-08 00:09:26

Gusar
Member
Registered: 2009-08-25
Posts: 3,606

Re: [SOLVED] Cannot bring wifi interface up

ipw2200 is a wext driver, iw won't work with it (iw requires a mac80211 driver). Use wireless_tools. Or, since netctl uses wpa_supplicant even for WEP networks, use that:

wpa_cli -i wlp2s3 status

BTW, shoot the person who is running a hidden (!) WEP (!!) network - seriously, shoot him. That's the most awful method of running a network that exists - fake "security" (hidden networks aren't really hidden at all) with encryption that can be cracked in under a minute.

Offline

#3 2013-11-08 00:29:10

AMaudio
Member
From: Ireland
Registered: 2013-11-07
Posts: 14

Re: [SOLVED] Cannot bring wifi interface up

Hi Gusar,

Thanks for your answer. I was trying to avoid using wireless_tools because the wiki says it's deprecated. I get an error when running the wpa_supplicant command you suggested:

# wpa_cli -i wlp2s3 status
Failed to connect to non-global ctrl_ifname: wlp2s3  error: No such file or directory

Thanks

Offline

#4 2013-11-08 01:23:59

Gusar
Member
Registered: 2009-08-25
Posts: 3,606

Re: [SOLVED] Cannot bring wifi interface up

wireless_tools is indeed deprecated. Because it uses wext, which is deprecated. But ipw2200 is a wext driver (it was written way before mac80211 existed), so you need to use a deprecated tool. wpa_supplicant supports both wext and mac80211.

If you get that error with wpa_cli, it means there's no wpa_supplicant instance controlling the wifi. Which probably means netctl couldn't start the profile. Look at netctl error messages in the journal. If they don't say anything useful, use wpa_supplicant manually instead of via netctl - this will require learning how to write a wpa_supplicant.conf for a WEP network, something that usually isn't documented in wikis (because who in their right mind still uses WEP). Or use wireless_tools, that is documented in the wiki.

Last edited by Gusar (2013-11-08 01:25:28)

Offline

#5 2013-11-08 09:38:24

AMaudio
Member
From: Ireland
Registered: 2013-11-07
Posts: 14

Re: [SOLVED] Cannot bring wifi interface up

Thanks for the advice. Will try again this evening and let you know the outcome.

Offline

#6 2013-11-08 18:05:26

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,489

Re: [SOLVED] Cannot bring wifi interface up

You can specify with "WPAdriver=" whether netctl initializes wpa_supplicant with wext or nl80211, have a look at

man netctl.profile

The default uses nl80211 first, so according to Gusar's suggestion, just changing the default might get it to work (without creating a manual wpa_supplicant.conf). If you want to try it manually, the wiki still has the wireless_tools commands: https://wiki.archlinux.org/index.php/Wi … nual_setup
Another point: the wireless interface was UP in your first command output here. The relevant part is the "UP" inside the brackets, the "state DOWN" is ambigiously misleading output.

Offline

#7 2013-11-09 01:04:17

AMaudio
Member
From: Ireland
Registered: 2013-11-07
Posts: 14

Re: [SOLVED] Cannot bring wifi interface up

Thanks for the tips, guys. Strike0, thanks for the clarification that my wireless interface was UP. That was very good to know!

I couldn't get WPAdriver=wext to work in the netctl.profile. So, I resorted to configure it manually using ip and iwconfig using a script that gets called by a systemd service at boot time. However, this seemed to have conflicted with my wired network profile, which was being set up by a netctl service that ran at startup. So, just to simplify everything, I decided to set up both the ethernet and the wireless connections manually using the same script that is called from a systemd service.

The code for systemd service is as follows:

[Unit]
Description=Connect ethernet and wifi

[Service]
Type=oneshot
ExecStart=/root/connect_wifi.sh
KillMode=none

[Install]
WantedBy=multi-user.target

The code for the script is:

#!/usr/bin/bash

# Ethernet network

ip link set enp2s0 up
ip addr add 192.168.1.5/26 dev enp2s0 > /dev/null 2>&1

# Wireless network

ip link set wlp2s3 up
iwconfig wlp2s3 essid MYWIRELESSNETWORK
iwconfig wlp2s3 key 123456778890ABCDEF
ip addr add 192.168.1.6/26 dev wlp2s3 > /dev/null 2>&1

# gateway

ip route add default via 192.168.1.ZZZ  > /dev/null 2>&1

# resolv.conf

echo "nameserver XXX.XXX.XXX.XXX" >  /etc/resolv.conf
echo "nameserver YYY.YYY.YYY.YYY" >> /etc/resolv.conf
echo "search example.com"      >> /etc/resolv.conf

Notice that there are two main "sections" in this script: an "Ethernet network" section and a "Wireless network" section. I tried combinations of commenting out one or the other sections and then booting the machine with very different and strange results. And would like to know your opinion about this:

To better explain these combinations, I summarise my observations in 4 "scenarios", each with one or more sub-scenarios each. Hopefully this makes it clearer.



1. Everything uncommented, booting with ethernet cable CONNECTED:
* Can ssh to machine using both IP addresses
* From machine can connect to the Internet
1.1 If I disconnect ethernet cable:
* I loose connection from both ssh sessions.
* From machine cannot connect to the internet.
* So it seems that the wireless wasn't really connected?
* Still have IPs on both wireless and ethernet and iwconfig says it's connected to router

2. Comment ethernet section out and leave everything else uncommented, boot computer with ethernet cable DISCONNECTED:
* Can ssh to machine using wireless IP (.6) cannot connect to machine using ethernet IP (.5) -- this is as expected
2.1 If I connect ethernet cable:
* Wireless network continues in operation (as expected): Can connect from machine to internet and can ssh to machine using wireless IP (.6)
* I don't get a wired IP address, which is also as expected I guess.

3. Comment ethernet section out and leave everything else uncommented, boot computer with ethernet cable CONNECTED:
* CANNOT ssh to machine using EITHER IP (.5 or .6) : no route to host reported in both cases.
* From machine cannot connect to internet.
* Don't have an IP address on any device (wireless or wired)
* iwconfig says there's no wifi connection to router
3.1 Disconnecting ethernet cable has no effect (I suppose as expected)

4. Uncomment ethernet section and comment wireless section out (everything else uncommented), boot computer with ethernet cable CONNECTED:
* Can ssh to machine using ethernet IP (.5) cannot connect to machine using wireless IP (.6) -- this is as expected
* From machine can connect to internet
* Have ethernet IP address, don't have wifi address, again as expected.
4.1 Run the commands from wireless section manually with ethernet cable CONNECTED
* Continue to be able to ssh to machine using ethernet IP (.5) and can now connect using wireless IP (.6)
* From machine can connect to internet
4.2 If I remove the ethernet cable at this point:
* Loose all connectivity to machine (cannot ssh via ethernet or wireless IP): no route to host
* From machine cannot reach the internet



Ideally, this is what I would like to observe:
1. Booting with EVERYTHING uncommented and ethernet network cable CONNECTED:
* Be able to ssh to machine using either IP ethernet or wireless
* From machine, be able to reach internet
1.1 If I remove ethernet cable:
* Be able to ssh to machine using wireless IP (if ethernet IP is not reachable, that's OK)
* From machine, be able to reach internet

2. Booting with EVERYTHING uncommented and ethernet network cable DISCONNECTED:
* Be able to ssh to machine using wireless IP (if ethernet IP is not reachable, that's OK)
* From machine, be able to reach internet
2.1 If I reconnect ethernet cable:
* It's OK if I have to run ethernet section manually

Offline

#8 2013-11-09 10:09:42

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,489

Re: [SOLVED] Cannot bring wifi interface up

Wow that's an extensive case analysis! It mixes your original issue of wireless not working with the handover of connections though. One issue is to sort out why your wireless netctl profile fails (what do the logs say?) and the other the automatic handover.

That the handover does not work is expected as you use a oneshot to set them up, but .systemd is not monitoring the connection status of the interfaces automatically. Have a look at the "wireless" and "netctl" wiki pages. netctl can be used with "ifplugd" to monitor connection status and can aso provide wired-wireless failover. The wireless wiki has info on manual setup on services. I would expect that you should be able to use the netctl ifplugd-service for your wired interface in combination with a manual script too.  But it would be better to use separate services for wired and wireless, if you continue to control the interfaces with your own scripts. One reason is that services also have an "ExecStop" section, but it also makes troubleshooting easier.

Offline

#9 2013-11-09 14:47:10

AMaudio
Member
From: Ireland
Registered: 2013-11-07
Posts: 14

Re: [SOLVED] Cannot bring wifi interface up

Thanks for the pointers, Strike0. The wired-wireless failover scenario does look quite interesting. So I'd like to explore that option more extensively. I attempted to create a master bond/failover connection via netctl with two slaves: one for the wired connection and another one for the wireless connection. For the wired connection I used a netctl profile and for the wireless connection I used a systemd service manually setting up the wireless connection, somewhat following the wiki pages you refer to.

All three services start up correctly, but when I unplug the ethernet cable, the wireless network doesn't take over. It seems that it's not really connected.

Here's the details of my configuration:

The master failover (bond) netctl profile:

# cat /etc/netctl/failover
Description='A wired connection with failover to wireless'
Interface='bond0'
Connection=bond
BindsToInterfaces=('enp2s0' 'wlp2s3')
IP=static
Address="192.168.1.5/26"
Gateway='192.168.1.1'
DNS=('XXX.XXX.XXX.XXX' 'YYY.YYY.YYY.YYY')
SkipNoCarrier='no'

The failover wired netctl profile:

# cat /etc/netctl/failover_wired 
Description='Failover wired network'
Interface=enp2s0
Connection=ethernet
IP=no
SkipNoCarrier=yes

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'

The systemd service for the wireless network:

# cat /etc/systemd/system/network-wireless\@.service 
[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes
#EnvironmentFile=/etc/conf.d/network-wireless@%i

ExecStart=/usr/bin/ip link set dev %i up
ExecStart=/usr/bin/iwconfig wlp2s3 essid MYNETWORKNAME
ExecStart=/usr/bin/iwconfig wlp2s3 key 0123456789ABCDEF
#ExecStart=/usr/bin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev %i
#ExecStart=/usr/bin/ip route add default via ${gateway}

#ExecStop=/usr/bin/ip addr flush dev %i
ExecStop=/usr/bin/ip link set dev %i down

[Install]
WantedBy=multi-user.target

After rebooting the machine, I see that all three profile/services started successfully:

# netctl status failover
netctl@failover.service - A wired connection with failover to wireless
   Loaded: loaded (/etc/systemd/system/netctl@failover.service; enabled)
   Active: active (exited) since Sat 2013-11-09 13:59:27 GMT; 34min ago
     Docs: man:netctl.profile(5)
  Process: 165 ExecStart=/usr/lib/network/network start %I (code=exited, status=0/SUCCESS)
 Main PID: 165 (code=exited, status=0/SUCCESS)

Nov 09 13:59:24 mycomputer systemd[1]: Starting A wired connection with failover to wireless...
Nov 09 13:59:27 mycomputer network[165]: Starting network profile 'failover'...
Nov 09 13:59:27 mycomputer network[165]: RTNETLINK answers: File exists
Nov 09 13:59:27 mycomputer systemd[1]: Started A wired connection with failover to wireless.
Nov 09 13:59:28 mycomputer systemd[1]: Started A wired connection with failover to wireless.
# netctl status failover_wired
netctl@failover_wired.service - Failover wired network
   Loaded: loaded (/etc/systemd/system/netctl@failover_wired.service; enabled)
   Active: active (exited) since Sat 2013-11-09 13:59:27 GMT; 34min ago
     Docs: man:netctl.profile(5)
  Process: 163 ExecStart=/usr/lib/network/network start %I (code=exited, status=0/SUCCESS)
 Main PID: 163 (code=exited, status=0/SUCCESS)

Nov 09 13:59:24 mycomputer systemd[1]: Starting Failover wired network...
Nov 09 13:59:27 mycomputer systemd[1]: Started Failover wired network.
Nov 09 13:59:28 mycomputer systemd[1]: Started Failover wired network.
# systemctl status network-wireless@wlp2s3.service 
network-wireless@wlp2s3.service - Wireless network connectivity (wlp2s3)
   Loaded: loaded (/etc/systemd/system/network-wireless@.service; enabled)
   Active: active (exited) since Sat 2013-11-09 13:59:25 GMT; 36min ago
  Process: 177 ExecStart=/usr/bin/iwconfig wlp2s3 key 12345667890ABCDEF (code=exited, status=0/SUCCESS)
  Process: 175 ExecStart=/usr/bin/iwconfig wlp2s3 essid MYNETWORKNAME (code=exited, status=0/SUCCESS)
  Process: 164 ExecStart=/usr/bin/ip link set dev %i up (code=exited, status=0/SUCCESS)
 Main PID: 177 (code=exited, status=0/SUCCESS)

Nov 09 13:59:24 mycomputer systemd[1]: Starting Wireless network connectivity (wlp2s3)...
Nov 09 13:59:27 mycomputer systemd[1]: Started Wireless network connectivity (wlp2s3).

This is the output from ip addr show, which as far as I can tell, it's all correct:

# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    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
2: enp2s0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000
    link/ether 00:11:43:4b:d6:ec brd ff:ff:ff:ff:ff:ff
3: wlp2s3: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc pfifo_fast master bond0 state DOWN qlen 1000
    link/ether 00:11:43:4b:d6:ec brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether 00:11:43:4b:d6:ec brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.5/26 brd 192.168.1.63 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 fe80::211:43ff:fe4b:d6ec/64 scope link 
       valid_lft forever preferred_lft forever

And here's the output from iwconfig. Notice that it says "Access point: not-associated"

# iwconfig
wlp2s3    IEEE 802.11bg  ESSID:"MYNETWORKNAME"  
          Mode:Managed  Channel:0  Access Point: Not-Associated   
          Bit Rate:0 kb/s   Tx-Power=20 dBm   Sensitivity=8/0  
          Retry limit:7   RTS thr:off   Fragment thr:off
          Encryption key:900A-0B0D-4B57-C007-1F5D-5C63-79   Security mode:open
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.

enp2s0    no wireless extensions.

bond0     no wireless extensions.

Offline

#10 2013-11-09 15:53:06

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,489

Re: [SOLVED] Cannot bring wifi interface up

I would wonder if your wifi is connected when you boot that config without a cable. As a sidenote I am using networkmanager myself, which automatically monitors the cable connection. So I have not tried the wireless failover like you do.

However, I still don't see you starting a service which monitors the cable. I don't see anything wrong in your services, but with the combo you are setting up you still need a netctl-ifplugd service or something else. Otherwise your problem remains: you unplug the cable and traffic goes to nirvana. I read in the wiki that a dhcpcd service monitors the cable too. I reckon you should try either of those. dhcpcd can be configured to use static addresses too by the way (since you seem to prefer those).

Offline

#11 2013-11-09 21:03:18

AMaudio
Member
From: Ireland
Registered: 2013-11-07
Posts: 14

Re: [SOLVED] Cannot bring wifi interface up

OK, I think I understand how this works much better now. Again, thanks for the info, Strike0. Every bit of info you give me, helps me understand another piece of the puzzle.

To be honest, I think this was all getting a bit too overcomplicated with netctl, systemctl and some other deamon that I still need to configure like ifplugd all involved. My head is spinning now.

So, after having a closer look to ifplugd, it seems to be the only thing I need to set up as it allows me to run code when the cable is plugged and when it is unplugged. So, I've disabled everything I had described in my previous post, customised a script for ifplugd and, voilà, my network is working perfectly. If I plug a cable, the computer uses the wired network, when I unplug the cable, it switches to the wifi. It works perfectly.

So, let me explain what I did just in case it helps somebody else. It probably isn't the most efficient way of doing things, but it works with my hardware (that old wifi card that is deprecated) and for my circumstances.

First I undid everything I did in my previous posts. Then, I disabled netctl (I'm not using it at all at the moment):

# systemctl disable netctl.service

Then, I modified the default service from ifplugd (you need to install ifplugd from the standard repositories). This is my current service:

# cat /usr/lib/systemd/system/netctl-ifplugd\@.service 
[Unit]
Description=Automatic wired network connection using netctl profiles
Documentation=man:netctl.special(7)
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
ExecStart=/usr/bin/ifplugd -i %I -r /etc/ifplugd/myscript.action -bfIns

[Install]
WantedBy=multi-user.target

I should probably have edited that file more since it says that it's using netctl profiles, but I'm not using them at all anymore. In fact, netctl is disabled at the moment. Notice that the only thing I edited from the original file is the call to the script "myscript.action". The original file had "netctl.action". And this how the script looks now:

# cat /etc/ifplugd/myscript.action 
#!/bin/bash

echo "nameserver XXX.XXX.XXX.XXX" >  /etc/resolv.conf
echo "nameserver YYY.YYY.YYY.YYY" >> /etc/resolv.conf

case "$2" in
  up)
	# stop wireless
	ip link set wlp2s3 down > /dev/null 2>&1 

	# start wired
	ip link set enp2s0 up
	ip addr add 192.168.1.5/26 dev enp2s0 > /dev/null 2>&1
	ip route add default via 192.168.1.1  > /dev/null 2>&1
	exit 0
  ;;
  down)
	# stop wired
	ip link set enp2s0 down > /dev/null 2>&1 	

	# start wireless
	ip link set wlp2s3 up
	iwconfig wlp2s3 essid MYWIFINAME
	iwconfig wlp2s3 key 0123456789ABCDEF
	ip addr add 192.168.1.5/26 dev wlp2s3 > /dev/null 2>&1
	ip route add default via 192.168.1.1  > /dev/null 2>&1
	
	exit 0
  ;;
  *)
    echo "Wrong arguments" >&2
  ;;
esac

exit 1

As I mentioned before, there are probably better ways to do this, but this serves me well. I can connect the ethernet cable, and the computer automatically uses that connection, if I unplug the cable, the computer uses the wifi, and it uses the exact same IP address! Which is brilliant for my purposes as this machine is used as a media server of sorts, so its IP address doesn't change regardless of whether it's on the wifi or on the ethernet. 

Thanks guys for all your help!

Offline

Board footer

Powered by FluxBB