Brutal Slackware Network Setup

short hostname is fine, although the installer did not let you

grep HOSTNAME /etc/rc.d/rc.M
vi /etc/HOSTNAME

static name resolution

cp -pi /etc/hosts hosts.dist
vi /etc/hosts

127.0.0.1 localhost
x.x.x.x slack.localdomain slack
x.x.x.x gw

identify your network interfaces as usual with either mii-tool or ethtool, then

mv -i /etc/rc.d/rc.inet1 /etc/rc.d/rc.inet1.dist
chmod -x /etc/rc.d/rc.inet1.dist
vi /etc/rc.d/rc.inet1

example for a static IP

#!/bin/bash

echo rc.inet1 PATH is $PATH
#PATH=$PATH:/usr/local/bin:/usr/local/sbin

if [[ $1 = stop || $1 = down ]]; then
    route delete default
    ifconfig eth0 down
    ifconfig lo down
else
    echo -n lo ...
    ifconfig lo up && echo done || echo FAIL

    echo -n eth0 ...
    ifconfig eth0 x.x.x.x/xx up && echo done || echo FAIL

    echo -n default route...
    route add default gw x.x.x.x && echo done || echo FAIL

    echo sshguard
    rm -f /var/run/sshguard.pid
    echo >> /var/log/sshguard.log
    date >> /var/log/sshguard.log
    /usr/local/sbin/sshguard >> /var/log/sshguard.log 2>&1 &

    # rc.inet2 disabled
    /etc/rc.d/rc.sshd start
fi

hints for enabling VLANs (for a single NIC)

            modprobe 8021q
            # self-verbose
            vconfig add eth1 XXXX

            echo -n eth1.XXXX ...
            ifconfig eth1 mtu 9000 up
            ifconfig eth1.XXXX mtu 9000 x.x.x.x/xx up && echo done || echo FAIL

Note: same for using VLANs on a bridge, you still need to set it up on the physical NICs first.

unused hint for larger queue

    # ifconfig ... txqueuelen 10000

another example for DHCP

#!/bin/bash

echo rc.inet1 PATH is $PATH

    if [[ $1 = stop || $1 = down ]]; then
            dhclient -r
            ifconfig eth0 down
            ifconfig lo down
    else
            echo -n lo...
            ifconfig lo up && echo done || echo FAIL

    # self-verbose
            dhclient -v eth0
    fi

don’t forget to enable the init script

chmod +x /etc/rc.d/rc.inet1

now if you want XEN and/or links aggregation - you can mix this with bridges and bonding

apply and check

/etc/rc.d/rc.inet1
ping -W1 -c1 208.67.222.222

DNS

cat > /etc/resolv.conf <<-EOF
nameserver 62.210.16.6
nameserver 62.210.16.7
#nameserver 208.67.222.222
#nameserver 208.67.220.220
EOF
ping -W1 -c1 opendns.com

Acceptance

for eth in eth0 eth1 eth2 eth3; do mii-tool $eth; done; unset eth

Trash

a better way to shut the NICs down would be

downall() {
        for netif in `ifconfig | grep -e '^[[:alpha:]]+: ' | cut -f1 -d:`; do
                [[ $netif = lo ]] && continue
                ifconfig $netif down
        done; unset netif
        exit 0
}

[[ $1 = stop ]] && downall

Resources

Why and How to Increase and decrease txqueuelen (Transmit Queue Lenght) in GNU / Linux http://www.pc-freak.net/blog/why-and-how-to-increase-and-decrease-txqueuelen-transmit-queue-lenght-in-gnu-linux/

Linux Increasing The Transmit Queue Length (txqueuelen) https://www.cyberciti.biz/faq/gentoo-centos-rhel-debian-fedora-increasing-txqueuelen/


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun