LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   VLAN configuring (https://www.linuxquestions.org/questions/slackware-14/vlan-configuring-885883/)

diwljina 06-12-2011 06:53 AM

VLAN configuring
 
Hi!

I was wondering what is the proper way to set up interface in Slackware to use VLANs. I do it by writing necessary commands in rc.local, but is there way to use inet1.conf?

Linux.tar.gz 06-17-2011 06:32 AM

Not sure.

Unfortunately, using this setting does not work :

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

Maybe someone will enhance this.

Ramurd 06-17-2011 07:17 AM

The way linux.tar.gz tried does indeed not work: the part between the square brackets is parsed in a integer-increment loop.
I think the original script uses values 0-4, but I'm too lazy to check, you may have to increase the value, or use a [2] or [3] instead of where I used [5].

I think the below may work (not tested):
Code:

IFNAME[5]="eth1:1"
IPADDR[5]="10.0.0.99"
NETMASK[5]=""
USE_DHCP[5]=""
DHCP_HOSTNAME[5]=""


Linux.tar.gz 06-17-2011 07:39 AM

Well done, sir !

It works, although some errors (in french) i'm too lazy to translate ;^)

Ramurd 06-17-2011 08:01 AM

probably the netmask, which was not set in the example configuration. But I am curious to the errors you get. The solution was done completely from the top of my head, coz I have never had to use this style :-)

Linux.tar.gz 06-17-2011 08:10 AM

I put a 255.255.255.0 netmask.

Here i am :

USAGE: ipmask <decimal netmask> <decimal IP address>
netmask: Unknown host

Linux.tar.gz 06-17-2011 08:14 AM

Oop, made a mistake.

I don't understand why it worked, because it won't anymore :/

I got :
SIOCSIFNETMASK: Ne peut attribuer l'adresse demandée
"can't give wanted adress"

Ramurd 06-17-2011 09:02 AM

Here's a snippet from /etc/rc.d/rc.inet1.conf I just created to try it out:
Code:

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

# Config information for eth1:
IFNAME[1]="eth0:1"
IPADDR[1]="192.168.3.1"
NETMASK[1]="255.255.255.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

If I run /etc/rc.d/rc.inet1 eth0_start and then /etc/rc.d/rc.inet1 eth0:1_start
and then check out ifconfig:
Code:

ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1f:d0:92:63:8d 
          inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:27 Base address:0xa000

eth0:1    Link encap:Ethernet  HWaddr 00:1f:d0:92:63:8d 
          inet addr:192.168.3.1  Bcast:192.168.3.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          Interrupt:27 Base address:0xa000

you see it actually worked, so it should go fine; it may be that the base interface needs to have an address (?)

diwljina 06-17-2011 02:15 PM

Actually, that's aliases and it works that way, but vlans are something else. I guess that inet1 doesn't know how to work with them. It should first load 8021q module if there is some vlans in configuration (or let rc.modules to handle that); then add specified vlans to desired interface using vconfig; bring up interface; and last thing inet1 knows how to do - set IP address, netmask and default route. I'll just keep using rc.local for this, but it would be nice to have Slackware take care of it in it's own way properly.

Linux.tar.gz 06-20-2011 11:24 AM

Oops :^)

So you have to tweak other init files, which is, imho, not a good idea. rc.local is for custom configs, and it's exactly what you do.

If it works as is, use your time to do other things ^^.


All times are GMT -5. The time now is 05:55 AM.