# How to get startup file for wireless interface?

## ratcheer

I'm a newbie, but I'm making some progress.   :Wink: 

I have successfully turned on kernel support for my Ralink RT-3062 wireless card. After doing that, I got an interface named wlp6s0. The wireless driver is loaded and "lspci -v" shows "Kernel driver in use: rt2800pci"

However, there is no corresponding file in /etc/init.d for starting the interface. I am expecting to have a file net.wlp6s0, but it still does not exist. I have searched the wiki, but everything just refers to running that file, there's nothing on how to create it. Where does that file come from and/or how do I create it?

Tim

----------

## khayyam

 *ratcheer wrote:*   

> However, there is no corresponding file in /etc/init.d for starting the interface. I am expecting to have a file net.wlp6s0, but it still does not exist.

 

Tim ... simply create a symbolic link from net.lo to net.wlp6s0 ...

```
# ln -s /etc/init.d/net.lo /etc/init.d/net.wlp6s0
```

For wireless you will need net-wireless/wpa_supplicant and an /etc/wpa_supplicant/wpa_supplicant.conf that describes the AP ... you might also want to provide some configuration in /etc/conf.d/net ... some examples:

/etc/wpa_supplicant/wpa_supplicant.conf

```
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel

update_config=1

network={

    ssid="Your_AP/ESSID"

    psk=your_password

    proto=WPA2

    auth_alg=OPEN

    key_mgmt=WPA-PSK

}
```

... that would be for a WPA2 (your AP may use something else).

You could leave the following undefined (dhcp will be used) but here is an example of various things you could provide as configuration ...

/etc/conf.d/net

```
modules_wlp6s0="!plug !iwconfig wpa_supplicant dhcpcd"

wpa_supplicant_wlp6s0="-Dnl80211"

config_wlp6s0="dhcp"

#enable_ipv6_wlp6s0="false" # if you want to disable ipv6
```

HTH & best ... khay

----------

## ratcheer

Thank you, khayyam.

So, if my ethernet interface is also started by a link to net.lo, and it is run automatically at startup, does it need to be run again for wireless, or will the one invocation handle both interfaces?

Tim

----------

## ratcheer

 *ratcheer wrote:*   

> Thank you, khayyam.
> 
> So, if my ethernet interface is also started by a link to net.lo, and it is run automatically at startup, does it need to be run again for wireless, or will the one invocation handle both interfaces?
> 
> Tim

 

This is what I have found by experimenting: With only net.enp4s0 started in default run level, wireless was not started. So, I added net.wlp6s0 to default run level. Wireless was still not started. However, if I manually run "/etc/init.d/net.wlp6s0 start", wireless starts, successfully.

Why is automation not working?

Tim

----------

## Logicien

Try

```
rc-update add net.wlp6s0 boot
```

----------

## khayyam

 *ratcheer wrote:*   

> Thank you, khayyam.

 

ratcheer/tim ... you're welcome ...

 *ratcheer wrote:*   

> This is what I have found by experimenting: With only net.enp4s0 started in default run level, wireless was not started. So, I added net.wlp6s0 to default run level. Wireless was still not started. However, if I manually run "/etc/init.d/net.wlp6s0 start", wireless starts, successfully. Why is automation not working?

 

Both net.wlp6s0 and net.wlp6s0 "provide net", having both is not "strict[ly]" needed ... /etc/rc.conf has the following to say ...

 *Quote:*   

> # Do we allow any started service in the runlevel to satisfy the dependency
> 
> # or do we want all of them regardless of state? For example, if net.eth0
> 
> # and net.eth1 are in the default runlevel then with rc_depend_strict="NO"
> ...

 

So, if you want both interfaces to "provide net" then you need to rc_depend_strict="YES". That said, its not clear in your case why both interfaces are needed, or what you're trying to achieve, it may be that you might want to have the interfaces managed by sys-apps/ifplugd or similar ...

HTH & best ... khay

----------

## ratcheer

Thank you, again.

I now have everything working satisfactorally, but based on what you just described, I am somewhat more confused than before. It seems that I do have to run both net.enp4s0 and net.wlp6s0, but I don't think I did anything to make it be that way. I certainly did not mess with that variable or, even know that it exists. But, I suppose alls well that ends well.   :Wink: 

Tim

----------

## khayyam

 *ratcheer wrote:*   

> Thank you, again.

 

... and again, you're welcome.

 *ratcheer wrote:*   

> I now have everything working satisfactorally, but based on what you just described, I am somewhat more confused than before. It seems that I do have to run both net.enp4s0 and net.wlp6s0, but I don't think I did anything to make it be that way. I certainly did not mess with that variable or, even know that it exists. But, I suppose alls well that ends well.

 

For them both to be active then you must have added both to the runlevel. Now, when you write "[...] seems that I do have to run both" it suggests thats not your intention, so simply remove one or other from default ... eg:

```
# rc-update del net.enp4s0 default
```

One or other interface "provide[s] net" so any service started via init that requires net is satisfied. Thats the basic idea at least ... the "rc_depend_strict" variable is so that in cases where both (or "all" if there are more than two) interfaces must be available (say if NATing, or in cases where there are many interfaces whose functioning are interdependent) it can be set to YES so that all of these must come up for "net" to be satisfied. This doesn't sound like what you're aiming at, and so I'm fairly sure you don't need both interfaces active (unless you have two seperate subnets or some such) ... that is why I asked about your particular use case, and what you're trying to achieve.

best ... khay

----------

