May 162011
 

This is some basic stuff, when setting a Linux box for networking. Sometimes, there is the need to isolate specific traffic from your router to be seen only by your second NIC, sometimes you just don’t want your NIC to stay in the default VLAN because of frequent network loops killing your PC, you don’t want to give another hundred dollars for 2-port demarcation device or you are small ISP and your backbone provider has appointed a range of VLANs for you and your points of interest around the city, so you have to get the tagged traffic on a Slackware Linux box and untag it for your customers. I’ve often used bridging of VLAN tagged traffic over a test PC in my work as a QA.
Reasons can be found enough for a small novel.
So in few words, when you need your  network interface to accept tagged traffic, untag it and then send it to your kernel, that’s how it’s done:

bash-4.1# lsmod | grep 802
bash-4.1# modprobe 8021q
bash-4.1# lsmod | grep 802
8021q                  18128  0
bash-4.1# vconfig add eth3 200
Added VLAN with VID == 200 to IF -:eth3:-
bash-4.1# ifconfig eth3.200 10.0.0.1/16 up
bash-4.1# ping 10.0.155.50 -I eth3.200
PING 10.0.155.50 (10.0.155.50) 56(84) bytes of data.
64 bytes from 10.0.155.50: icmp_req=1 ttl=63 time=0.286 ms
64 bytes from 10.0.155.50: icmp_req=2 ttl=63 time=0.286 ms
64 bytes from 10.0.155.50: icmp_req=3 ttl=63 time=0.275 ms
64 bytes from 10.0.155.50: icmp_req=4 ttl=63 time=0.281 ms
^C
--- 10.0.155.50 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.275/0.282/0.286/0.004 ms
bash-4.1#

802.1q is the name of the protocol, the Kernel module is called 8021q. If the module is already loaded, the modprobe line can be omitted. If you want the module loaded at startup, you can add it in /etc/rc.local or /etc/rc.d/rc.modules (your preference). The first will load the module when everything else is already set. The VLAN configuration will be set regardless the module is loaded AFTER the ifconfig and vconfig have done their jobs.

The vconfig line adds the actual VLAN to Ethernet card 3 (change, according to your setup) and the ifconfig is setting IP address and mask (change to your setup or omit), and is enabling the Ethernet card. Finaly, you get one eth3 and one eth3.200:

bash-4.1# ifconfig eth3
eth3      Link encap:Ethernet  HWaddr 00:0E:2E:72:96:F7 
 inet addr:10.0.0.2  Bcast:10.0.255.255  Mask:255.255.0.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:19 Base address:0xdc00 

bash-4.1# ifconfig eth3.200
eth3.200  Link encap:Ethernet  HWaddr 00:0E:2E:72:96:F7 
 inet addr:10.0.0.1  Bcast:10.255.255.255  Mask:255.0.0.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:0
 RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

bash-4.1#

On the same Ethernet card, more VLANs can be enabled by adding them the same way. (no need to load the Kernel module every time, in case you don’t know that) If you need the VLAN removed from your NIC, do the reverse:

bash-4.1# ifconfig eth3.200 down
bash-4.1# vconfig rem eth3.200
Removed VLAN -:eth3.200:-

For some reason, there is no decent configuration example for how to make Slackware enable VLAN on specific NIC in boot process. I’ve made a short script and attached it to rc.local. It executes when everything else is already set, but I did not need it earlier in the first place:

#!/bin/bash

echo "Setting vlans ..."
modprobe 8021q
vconfig add eth3 200
ifconfig eth3.200 10.0.0.5/16 up
echo "... done"
 Posted by at 5:43 pm

Slackware linux as (basic) TFTP server

 l!nux  Comments Off on Slackware linux as (basic) TFTP server
May 162011
 

Slackware has one of the most easy to install and setup TFTP servers around. It’s really simple. That’s what you do in a nut shell:

su
wget ftp://ftp.slackware.com/pub/slackware/slackware-current/slackware/n/tftp-hpa-0.49-i486-1.txz
installpkg tftp-hpa-0.49-i486-1.txz
echo "tftp  dgram   udp     wait    root    /usr/sbin/in.tftpd  in.tftpd -s /tftpboot -r blksize" >> /etc/inetd.conf
mkdir /tftpboot
chmod +777 /tftpboot
chown nobody /tftpboot
touch /tftpboot/test.txt
echo "blah blah blah" >> /tftpboot/test.txt
/etc/rc.d/rc.inetd restart
tftp 127.0.0.1 -c get test.txt
cat test.txt

That will do the job most quickly [and a little bit risky]. If you need the above gibberish explained, that’s what happens:

su

You need to be root or super user to install packages and setup configuration files  in  /etc directory.

wget ftp://ftp.slackware.com/pub/slackware/slackware-current/slackware/n/tftp-hpa-0.49-i486-1.txz
installpkg tftp-hpa-0.49-i486-1.txz
echo "tftp  dgram   udp     wait    root    /usr/sbin/in.tftpd  in.tftpd -s /tftpboot -r blksize" >> /etc/inetd.conf

Those few lines will differ a bit in other/older/newer versions of Slackware Linux, but basically, they get the package, install it and setup the tftpd daemon to start at boot time with some important parameters. If you already have the package installed, the wget and install can be skipped. The echo line in the end is quite insecure, so it’s better to open the configuration file and uncomment it’s own config line (remove the pound sign in the line beginning with #tftp dgram udp). That’s the right way to do it, if you are not in a hurry, because the command shown here will add another line in the file. No one can guarantee us, there is no such line in the file already and no one can tell if the parameters are not going to change in future version or are supported in older version. If you know what this line is actually doing – feel free to copy and paste everything. It’s enough. (If you want to know what it actually does – it starts tftpd listening on UDP port 69 for tftp commands as a root user, puts it to silent mode and operates in directory /tftpboot)

mkdir /tftpboot
chmod +777 /tftpboot
chown nobody /tftpboot
touch /tftpboot/test.txt
echo "blah blah blah" >> /tftpboot/test.txt

We create the directory, change it’s ownership to nobody and make it accessible to everyone. Than we create a test file and fill in some text which we will use for 😀 ahem … test of course.

/etc/rc.d/rc.inetd restart
tftp 127.0.0.1 -c get test.txt
cat test.txt

We restart the internet super daemon and get the file we created via tftp protocol. And just in case, we check if we got the file with the line “blah blah blah” inside in the current directory where we just downloaded it.

That’s all there is for this TFTP server. Quick and easy.

Short disclaimer: Suitable for all simple uses as getting configuration files or boot images on Cisco/Telco/Extreme and other units I have not used. Also not setting any actual securities, so if you are paranoid slacker – this article is not for you. Google for some more extensive guide.

 Posted by at 1:27 pm

Saints Cyril and Methodius Day (24 may)

 General  Comments Off on Saints Cyril and Methodius Day (24 may)
May 132011
 
Cyrillic

Cyrillic

Also called the Day of the Slavic literature and alphabet.

Saint Cyril and Methodius were born in XI century with Byzantine parents  in the city of Solun (Thessaloniki). They have influenced all of the Slavic culture and traditions, and eastern orthodox church Bible is written in Greek and the original Cyrillic developed by the brothers and their pupils.

Saint Cyril and Methodius have actually created a set of signs called Glagolitsa (Глаголица) and later, their pupils and followers have simplified and evolved this set of letters to the one known in present days. This set is named after Cyril (younger of the two brothers).

 

Glagolic

Glagolic

The word glagol in old slavic language actually means word.  The original Glagolitic alphabet was a bit hard to understand and remember, and too different from Latin and Greek alphabets that were used widely for writing books at this time. For that reason, the Glagolitic alphabet was abandoned after the development of the Cyrillic almost half century later.

The Cyrillic is spread to wide use by the Bulgarian Tzar Boris who wished the Bulgarian church to be independent of the Constantinople. For those reasons he built two academic schools in the cities of Ohrid and Preslav and invited the remaining pupils of Cyril and Methodius to teach and develop books, codex of laws and a Slavic Bible.

From those schools, hundreds of educated pupils spread the books and bibles in the Slavic countries. It was readily adopted by many Slavic monarchs threatened by the heavy presence of western (catholic) and eastern (orthodox) churches of Rome and Constantinople.

The two brothers were finally declared saints by the Catholic church at late 19-th century by  pope Leo XIII.

Every Bulgarian school will have a holiday at this date and it’s the first day of the summer school vacation of the younger kids. There will be a small festivity held in every school with music and verses from various Bulgarian classic authors. The church will praise the saints with small procession holding in front an Icon of the brothers in large flower wreath.

 Posted by at 3:42 pm