LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Setting IFNAME (http://www.linuxquestions.org/questions/slackware-14/setting-ifname-4175475044/)

marijan 08-28-2013 11:34 AM

Setting IFNAME
 
Hi,

It is my first post to LQ. I recently installed Slackware 14.0 and I like it. It runs on old Thinkpad R51.
TP has fxp and ipw network interface, automatically configured as eth0 and eth1. According to man, interface name can be changed by setiing IFNAME variable in rc.inet1.conf. I tried to add:

IFNAME[1]="wlan0".

But it doesn't work. I don't see eth1 nor wlan0 anymore. It is not an issue at all, but I am just curious did I miss something else.

Marijan

ml4711 08-28-2013 01:29 PM

from /etc/rc.d/rc.inet1
# If a value for IFNAME[n] is not set, we assume it is an eth'n' interface.

i.e. you do not need to set IFNAME, if your interfaces are eth0, eth1, etc

It is only possible to use real interface names in IFNAME[],
you can not change an interface name by putting a name in an IFNAME[] variable.

If you only had one interface named wlan0, you had to put that name into IFNAME[0].

Welcome to a new slacker :-)

onebuck 08-28-2013 01:31 PM

Member Response
 
Hi,

Welcome to LQ & Slackware!
EDIT:I just noticed that the file shown was modified by me. You can still use it as an example by setting your local information.

Look at the original '/etc/rc.d/rc.inet1.conf' comment information at the top. Plus notice how each section provides configurable arguments for suggested interfaces;
Quote:

If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").

# You can configure network interfaces other than eth0,eth1... by setting
# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
# or empty, it is assumed you're configuring eth<interface>.

# Several other parameters are available, the end of this file contains a
# comprehensive set of examples.

# =============================================================================

# Config information for eth0:
#IPADDR[0]="192.168.1.14"
#IPADDR[0]="192.168.1.114"
#NETMASK[0]="255.255.255.0"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""

# Config information for eth1:
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

# Config information for eth2:
IPADDR[2]=""
NETMASK[2]=""
USE_DHCP[2]=""
DHCP_HOSTNAME[2]=""

# Config information for eth3:
IPADDR[3]=""
NETMASK[3]=""
USE_DHCP[3]=""
DHCP_HOSTNAME[3]=""

# Default gateway IP address:
GATEWAY="192.168.1.1"

# Change this to "yes" for debugging output to stdout. Unfortunately,
# /sbin/hotplug seems to disable stdout so you'll only see debugging output
# when rc.inet1 is called directly.
DEBUG_ETH_UP="no"

# Example of how to configure a bridge:
# Note the added "BRNICS" variable which contains a space-separated list
# of the physical network interfaces you want to add to the bridge.
#IFNAME[0]="br0"
#BRNICS[0]="eth0"
#IPADDR[0]="192.168.0.1"
#NETMASK[0]="255.255.255.0"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""

## Example config information for wlan0. Uncomment the lines you need and fill
## in your info. (You may not need all of these for your wireless network)
#09-18-12:16:00 gws

IFNAME[4]="wlan0"
IPADDR[4]="192.168.1.14"
NETMASK[4]="255.255.255.0"
#USE_DHCP[4]="yes"
#DHCP_HOSTNAME[4]="icculus-wireless"
#DHCP_KEEPRESOLV[4]="yes"
#DHCP_KEEPNTP[4]="yes"
#DHCP_KEEPGW[4]="yes"
#DHCP_IPADDR[4]=""
#WLAN_ESSID[4]=BARRIER05
If you did not comment out 'IFNAME[4]="wlan0"' you would be attempting to assign the same name & interface. I would use the original configuration. If you want both eth0 & wlan0 then use 'ifplugd' to control the wired interface when connected or not;
Quote:

ifplugd <- 'ifplugd is a Linux daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure the interface when a cable is really connected. ifplugd interfaces with your distribution's native network configuration utilities.'
You can look at Slackware Doc Project section for Configure your new Slackware System to aid you in configuring the system.

Hope this helps.

Paulo2 08-28-2013 02:12 PM

I think the order that modules are loaded determines which one is eth0 or eth1.

You can change this editing "/etc/udev/rules.d/70-persistent-net.rules" (or similar)

Be sure that in "/etc/rc.d/rc.inet1.conf" the var "USE_DHCP[x]" is set to yes in each ethx section.

Maybe this has practical use in some case:D


Welcome to a new slacker :hattip:

marijan 08-29-2013 09:11 AM

My interfaces are working. I just tried to change interface name.
I understood it should be possible. Here is part of rc.inet1.conf.
It will create eth0 and eth1. But if I uncomment line 22,
I loose eth1. And wlan0 didn't pop up, as expected.
What is the purpose of IFNAME variable?
Quote:

1 # /etc/rc.d/rc.inet1.conf
2 #
3 # This file contains the configuration settings for network interfaces.
4 # If USE_DHCP[interface] is set to "yes", this overrides any other settings.
5 # If you don't have an interface, leave the settings null ("").
6
7 # You can configure network interfaces other than eth0,eth1... by setting
8 # IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
9 # or empty, it is assumed you're configuring eth<interface>.
10
11 # Several other parameters are available, the end of this file contains a
12 # comprehensive set of examples.
13 # =============================================================================
14
15 # Config information for eth0:
16 IPADDR[0]=""
17 NETMASK[0]=""
18 USE_DHCP[0]=""
19 DHCP_HOSTNAME[0]=""
20
21 # Config information for eth1:
22 #IFNAME[1]="wlan0"
23 IPADDR[1]=""
24 NETMASK[1]=""
25 USE_DHCP[1]="yes"
26 DHCP_TIMEOUT[1]=15 # The default timeout for the DHCP client is 10s
27 WLAN_ESSID[1]="WPARaleigh"
28 WLAN_WPA[1]="wpa_supplicant"
29 WLAN_WPAWAIT[1]=10 # In case it takes long for the WPA association
30
31 # Config information for eth2:
32 IPADDR[2]=""
33 NETMASK[2]=""
34 USE_DHCP[2]=""
35 DHCP_HOSTNAME[2]=""

marijan 08-29-2013 09:30 AM

Oh, I read again onebuck answer.
So, IFNAME is used to configure interfaces which are automatically assigned name
other than ethX?

Richard Cranium 08-29-2013 09:34 AM

Quote:

Originally Posted by marijan (Post 5018256)
What is the purpose of IFNAME variable?

If you looked at the contents of /etc/rc.d/rc.inet1, you could probably figure that out.

marijan 08-29-2013 09:54 AM

You are right.


All times are GMT -5. The time now is 07:43 AM.