Networking
From TechWiki
Contents |
Note
If you want a Linux server, a Mac and a Windows machine to get along with each other and don't want to mess with Samba or NFD and want centralized data storage and want network printing, just get an Ethernet hard disk Custom (yes, you still ned to get a printer) and voila!
Setup
See Custom
Commands
For bandwidth monitoring tools, see Linux Commands.
- Resolve IP number
host whatever.domain.com
- Edit network interface settings:
/sbin/ifconfig
Adding network interface:
ifconfig eth0 IP netmask number up
- Kernel routing table:
/sbin/route
Add gateway:
route add default gw IP
- Netwot interfaces:
/etc/network/interfaces
- Host names in:
/etc/hosts
something like:
127.0.0.1 localhost.localdomain localhost core1 client-IP clientname clientname
- Hostname:
hostname
read from:
/etc/hostname
- Nameserver in:
/etc/resolv.conf
- Get IP:
nslookup url
- Test IP with:
ping IP
NFS
Network File System: allow machines to mount a disk partition on a remote machine as if it were on a local hard drive.
Packages used:
nfs-common nfs-kernel-server or nfs-user-server (only the latter worked)
Howto:
Shortcuts
In /usr/sbin/:
rpc.mountd rpc.nfsd
DHCP
Basic Setup
Every time you boot a computer attached to the network, the router assigns it a new IP (via DHCP, using dhclient). Hence in a network with e.g. laptops, as a result, IPs can vary. So static setups like /etc/hosts won't be enough.
Setting up a DHCP server, allows the automatic assignment of IP and names via the MAC address.
- Install:
apt-get install dhcp
- Daemon:
/etc/init.d/dhcp {start|stop|restart|force-reload}
- Configuration:
/etc/dhcpd.conf
something like:
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.123.0 netmask 255.255.255.0 {
# Domainname
option domain-name "nucleus";
# DNS
option domain-name-servers DNS-IP1, DNS-IP2;
# Internet-Gateway (Router)
option routers IP;
# Router
option subnet-mask 255.255.248.0;
option broadcast-address 192.168.123.255;
# Configuration clients
host host1
{ hardware ethernet MAC address (seperated with :);
fixed-address Assigned-IP;
}
range 192.168.1.200 192.168.1.200;
}
Now you can set up names and IPs in /etc/hosts.
Note that some routers allow static assignments of IPs via MAC addresses. And if your router is enabled as a DHCP-server, disable the service.
More here: linux-fuer-alle.de.
Automatic Configuration during Boot Time
- Start the dhcp server (see Installing Debian GNU/Linux#Starting Services):
ln -s /etc/init.d/dhcp /etc/rc4.d/S02dhcp
- Edit /etc/network/interfaces:
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
broadcast 192.168.0.255
gareway 192.168.1.254
Samba
Linking the Windows and Linux world. Can also be used to link Mac OSX.
Install:
apt-get install samba apt-get install samba-common apt-get install swat (webbased admin tool)
To mount Samba devices, install smbfs, i.e.,
apt-get install smbfs
Define shares in /etc/samba/smb.conf, e.g.:
[homes] comment = Home Directories browseable = no
