LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-14-2013, 05:41 AM   #1
VARNICA
LQ Newbie
 
Registered: Apr 2011
Posts: 11

Rep: Reputation: 0
Multiple IP address


Hello,

I need to setup an network interface with two ip address. I add in /etc/rc.d/rc.inet1.conf


Code:
/etc/rc.d/rc.inet1.conf 


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

# Config secondary ip address
IFNAME[1]="eth0:1"
IPADDR[1]="10.0.0.49"
NETMASK[1]="255.255.255.0"
USE DHCP[1]=""
DHCP_HOSTNAME[1]=""
But when restart network i have an error

Quote:
SIOCSIFFLAGS:Cannot assign requested address
cat: /sys/class/net/eth0:1/uevent: No such file or directory
cat: /sys/class/net/eth0:1/uevent: No such file or directory
What's the problem
???
 
Old 11-14-2013, 06:22 AM   #2
ml4711
Member
 
Registered: Aug 2012
Location: Ryomgård, Danmark
Distribution: Slackware64
Posts: 146

Rep: Reputation: 103Reputation: 103
You have to declare (create) the interface before you can use it!

A good way to create it is:

1. create this file and make it executable
"/etc/rc.d/rc.netdevice"

containing this command

"ifconfig eth0:1 up"

rc.netdevice is sourced from /etc/rc.d/rc.modules
(in slackware 14.0, but do not know if also in 14.1)

Now you just execute the rc.modules file and restart your network!

Edit: An alias interface is NOT a "real" interface,
and therefore not seen here.
Quote:
SIOCSIFFLAGS:Cannot assign requested address
cat: /sys/class/net/eth0:1/uevent: No such file or directory
cat: /sys/class/net/eth0:1/uevent: No such file or directory
so it seems you need to do it later manually in f.ex rc.local, i.e

Code:
ifconfig eth0:1 10.0.0.49 netmask 255.255.255.0 up
My first advice is needed if you want to make f.ex an vlan interface
and to configure it in rc.inet1.conf

Enjoy

Last edited by ml4711; 11-14-2013 at 07:09 AM.
 
Old 11-14-2013, 07:30 AM   #3
VARNICA
LQ Newbie
 
Registered: Apr 2011
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks,

I put in rc.local

Quote:
ifconfig eth0:1 10.0.0.49 netmask 255.255.255.0 up
and it works, but I'm still interested to managed it from rc.inet1.conf
 
Old 11-14-2013, 10:55 AM   #4
ml4711
Member
 
Registered: Aug 2012
Location: Ryomgård, Danmark
Distribution: Slackware64
Posts: 146

Rep: Reputation: 103Reputation: 103
Hello again

I have now looked at the script,
that generates the error message (/etc/rc.d/rc.wireless line 96)
and it is harmless. That line checks if it is a wireless interface.

If the alias interface works, when you start it from rc.inet1.conf,
then don't care about the error message - but if it really bothers you,
you have two possibilities.

If you do not have any wireless interfaces in your machine then remove
the executable bit from rc.wireless. Otherwise you have to patch the script
to remove ther error message (but this is not so good an idea, since it gets
overwritten next time the scripts is updated).

Anyway here you go, change the line

Code:
elif [ "$(cat /sys/class/net/${1}/uevent | grep DEVTYPE)" = "DEVTYPE=wlan" ]; then

to

elif [ "$(cat /sys/class/net/${1}/uevent 2>/dev/null | grep DEVTYPE)" = "DEVTYPE=wlan" ]; then

Last edited by ml4711; 11-14-2013 at 10:57 AM.
 
Old 11-14-2013, 04:36 PM   #5
VARNICA
LQ Newbie
 
Registered: Apr 2011
Posts: 11

Original Poster
Rep: Reputation: 0
Hello thank you for help,

I am not traying to set up a wireless interface, I wont to set up a wierd lan interface with two ip address, from which I can connect to two separate network,

1. 192.168.1.0/24 network
2. 10.0.0.0/24 network

I follow your advice but the part i do not understand is

"Now you just execute the rc.modules file and restart your network!"

How to execute?
 
Old 11-15-2013, 05:28 AM   #6
ml4711
Member
 
Registered: Aug 2012
Location: Ryomgård, Danmark
Distribution: Slackware64
Posts: 146

Rep: Reputation: 103Reputation: 103
You only have to do one thing.

1. In rc.inet1.conf, as you already have done.
Code:
# Config secondary ip address
IFNAME[1]="eth0:1"
IPADDR[1]="10.0.0.49"
NETMASK[1]="255.255.255.0"
USE DHCP[1]=""
DHCP_HOSTNAME[1]=""
But you can do this too, if you like

2. Disable executable bit on rc.wireless
- this is NOT needed to get the interface up
but only to not get the error message which IS harmless
Code:
chmod -x /etc/rc.d/rc.wireless
And you are done :-)

The advice about rc.netdevice and rc.modules is not needed for
an alias interface, as it is created implicit with the ifconfig command.

It is only if you f.ex want to setup vlan interfaces from rc.inet1.conf,
then the interfaces have to be created beforehand.

To execute rc.modules or any other script, just type the name of the script and press ENTER:
Code:
/etc/rc.d/rc.modules 
and press ENTER.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple IP Binding and Source IP Address Murdock1979 Linux - Networking 2 07-02-2012 07:15 AM
Multiple public ip address problem ??? cutflash Linux - Networking 1 04-08-2008 04:52 PM
Multiple names for a single ip address netman4ttm Linux - Networking 4 08-27-2007 09:35 AM
Bind multiple IP address FriendlyLinuxGuy Red Hat 3 02-08-2006 12:10 AM
multiple IP address najeeb Linux - General 1 09-14-2003 01:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration