LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 03-20-2012, 03:58 PM   #1
sysslack
Member
 
Registered: Feb 2006
Posts: 69

Rep: Reputation: 15
Howto make dhcp work with vlan tagging on slackware?


Hi
I have followed a great guide on VLAN tagging on slackware and made it work
with static ip adress behind a router that can handle VLAN tagging.
DHCP server is also activated for that VLAN. But slackware does not get an valid adress from router, only 169.x.x.x adress. That is why I put a static ip instead in script below.
However it would be nice to configure it for dhcp in file /etc/rc.d/rc.inet1.conf instead of static ip on slackware
Is there a way to do this on slackware for a tagged VLAN?
Here is a script I put in /etc/rc.d/rc.local on slackware 13.37

Code:
vim /etc/rc.d/rc.local
echo "Setting VLAN ..."
modprobe 8021q
vconfig add eth0 10
ifconfig eth0.10 10.0.0.5/24 up
echo "... done"
echo "adding default gateway"
route add default gw 10.0.0.1
echo "... done"
echo "adding dns"
echo "nameserver 8.8.8.8 " >>/etc/resolv.conf
echo "... done
Any Ideas?

Last edited by sysslack; 03-20-2012 at 04:10 PM.
 
Old 03-20-2012, 09:40 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,339

Rep: Reputation: Disabled
You could add the interface name in rc.inet1.conf:
IFNAME[1]="eth0.10"
USE_DHCP[1]="yes"
...
The vconfig command still needs to be run before rc.inet1 is executed. Fortunately, the Slackware startup scripts check for the existence of /etc/rc.d/rc.netdevice and, if the file exists and is executable, runs it prior to calling rc.inet1.

Historically, this script was used to load non-PnP drivers for ISA NICs. In a perfect world, Slackware would have VLAN support in rc.inet1/rc.inet1.conf, but this is an acceptable workaround IMHO. Create /etc/rc.d/rc.netdevice:
#!/bin/sh
/sbin/modprobe 8021q
/sbin/vconfig add eth0 10
Make it executable (chmod u+x /etc/rc.d/rc.netdevice) and you should be good to go.
 
Old 03-21-2012, 02:52 PM   #3
sysslack
Member
 
Registered: Feb 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Thank you
You pointed me in the right direction

Unfortunately it did not work.
error
dhcpcd up_interface network is down
 
Old 03-21-2012, 03:11 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,339

Rep: Reputation: Disabled
What does ifconfig -a say? Is the host interface (eth0) up? If not, you could try adding ifconfig eth0 up to /etc/rc.d/rc.netdevice.
 
Old 03-22-2012, 03:12 PM   #5
sysslack
Member
 
Registered: Feb 2006
Posts: 69

Original Poster
Rep: Reputation: 15
thank you
I have tried it "ifconfig eth0 up" but it did not work either
ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:1E:EC:68:80:A2
inet addr:169.254.33.56 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::21e:ecff:fe68:80a2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:210 errors:0 dropped:0 overruns:0 frame:0
TX packets:156 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:20672 (20.1 Kb) TX bytes:28516 (27.8 Kb)

eth0.10 Link encap:Ethernet HWaddr 00:1E:EC:68:80:A2
inet6 addr: fe80::21e:ecff:fe68:80a2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:180 errors:0 dropped:0 overruns:0 frame:0
TX packets:121 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:16352 (15.9 Kb) TX bytes:22432 (21.9 Kb)

eth1 Link encap:Ethernet HWaddr 00:21:00:20:C6:6E
inet6 addr: fe80::221:ff:fe20:c66e/64 Scope:Link
UP BROADCAST RUNNING 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:17

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:68 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3740 (3.6 Kb) TX bytes:3740 (3.6 Kb)


dmesg |grep eth0
[ 6.393374] e100 0000:02:08.0: eth0: addr 0xf0101000, irq 20, MAC addr 00:1e:ec:68:80:a2
[ 41.040158] e100 0000:02:08.0: eth0: NIC Link is Up 100 Mbps Full Duplex
[ 41.040415] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 41.040598] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 43.234161] e100 0000:02:08.0: eth0: NIC Link is Up 100 Mbps Full Duplex
[ 43.234422] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 43.234604] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 43.262159] e100 0000:02:08.0: eth0: NIC Link is Up 100 Mbps Full Duplex
[ 43.262415] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 43.262597] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 54.098041] eth0: no IPv6 routers present
[ 229.410035] eth0.10: no IPv6 routers present

Last edited by sysslack; 03-22-2012 at 03:14 PM.
 
Old 03-22-2012, 04:13 PM   #6
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,339

Rep: Reputation: Disabled
According to dmesg, the link went up and down several times during the boot process. Unless you physically unplugged and re-inserted the network cable or power cycled the switch/router, this might indicate a layer 1 (physical) problem.

The output from ifconfig says that all links are now up. Have you tried running dhcpcd eth0.10 from the command line? You might want to run tcpdump -i eth0.10 udp port 67 at another console first, to see if the dhcp server responds at all.
 
Old 03-23-2012, 03:41 AM   #7
sysslack
Member
 
Registered: Feb 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Thank you
yes I have tried with dhclient eth0.10 and that worked, but where to put it so it works in a script?
this is the output of tcpdump

Code:
 tcpdump -i -v  eth0.10 udp port 67
tcpdump: -v: No such device exists
(SIOCGIFHWADDR: No such device)

Last edited by sysslack; 03-23-2012 at 04:24 AM.
 
Old 03-23-2012, 01:36 PM   #8
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,339

Rep: Reputation: Disabled
The -i parameter to tcpdump specifies the interface, which in this case is eth0.10. Putting another parameter between -i and the interface name won't work.

It doesn't really matter though, if you've already confirmed that you can indeed get an IP address via DHCP. The problem has to be related to one of the scripts.

You could try inserting a debug statement or two into rc.netdevice and/or rc.inet1 and see what happens at boot. For instance, ifconfig -a at the end of rc.netdevice could be helpful in determining the cause of the problem.
 
Old 03-27-2012, 03:45 PM   #9
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slackware, debian, ubuntu
Posts: 666

Rep: Reputation: 39
hello, sorry to intervene, could the OP send us the link to that vlan guide on slackware?
 
Old 04-01-2012, 06:33 AM   #10
sysslack
Member
 
Registered: Feb 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Thank You!
It looks finally as it works:

Code:
tcpdump -i eth0.10 -v udp port 67
tcpdump: listening on eth0.10, link-type EN10MB (Ethernet), capture size 65535 bytes
this is my rc.local:

Code:
echo "Setting VLAN ..."
modprobe 8021q
vconfig add eth0 10
ifconfig eth0.10 up
dhclient eth0.10
echo "... done"
route add default gw 192.168.7.1
echo "adding dns"
echo "nameserver 8.8.8.8  >>/etc/resolv.conf
echo "... done"
this is my rc.inet1.conf:

Code:
# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""

# Config information for VLAN interface eth0.10:
IFNAME[0]="eth0.10"
USE_DHCP[0]="yes"
 
  


Reply



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
Lenny Debian VLAN tagging Q Allanon_TB Linux - Networking 1 05-30-2010 08:12 AM
802.1Q vlan tagging help td3201 Linux - Networking 1 09-23-2009 06:39 PM
How vlan work on dhcp finsh Linux - Server 4 03-02-2009 10:38 AM
Catalyst 2924, DMZ and VLAN Tagging metallica1973 Linux - Networking 28 02-22-2008 07:14 AM
VLAN Tagging and Cisco 2924XL EN questions metallica1973 Linux - Networking 4 01-29-2008 12:08 PM

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

All times are GMT -5. The time now is 11:00 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