Archive for category network

Linux networking/ip notes

Networking can be a pain, and in linux there are several config files that I must remember where they are and what they do. Note Ubuntu is a bit different.

/etc/sysconfig/network
For various configuration like hostname, gateway, and/or the type of protocol to use.
The below is a summary of possible field and their values, thanks to this faq

NETWORKING=answer, where answer is yes or no -Configure networking or not to configure networking.
FORWARD_IPV4=answer, where answer is yes or no -Perform IP forwarding or not to perform IP forwarding.
HOSTNAME=hostname, where hostname is the hostname of your server.
GATEWAY=gwip, where gwip is the IP address of the remote network gateway -if available.
GATEWAYDEV=gwdev, where gwdev is the device name eth# you use to access the remote gateway.

an example network file can be

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=jack-machine
GATEWAY=10.11.0.1

/etc/sysconfig/network-scripts/ifcfg-eth0
This file contains the configuration for a specific network device (in our case it is ifcfg-eth0)

DEVICE=devicename, where devicename is the name of the physical network device.
IPADDR=ipaddr, where ipaddr is the IP address.
NETMASK=netmask, where netmask is the netmask IP value.
NETWORK=network, where network is the network IP address.
BROADCAST=broadcast, where broadcast is the broadcast IP address.
ONBOOT=answer, where answer is yes or no. Do the interface need to be active or inactive at boot time.
BOOTPROTO=proto, where proto is one of the following :
none - No boot-time protocol should be used.
bootp - The bootp now pump protocol should be used.
dhcp - The dhcp protocol should be used.
USERCTL=answer, where answer is one of the following:
yes - Non-root users are allowed to control this device.
no - Only the super-user root is allowed to control this device.

an example network-script file can be

DEVICE=eth0
IPADDR=208.164.186.1
NETMASK=255.255.255.0
NETWORK=208.164.186.0
BROADCAST=208.164.186.255
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

/etc/resolv.conf
Contains information on the dns that this machine is using
An example file would be

search example.com
;the name server that the resolver should query.
nameserver 10.11.0.5

A special note on the search parameter; it is the list of domains that we will search by default. for example if we nslookup on svn, it will actually lookup for svn.example.com. if we didn’t have the search rule below, it would just search for svn and give a not found response.

Leave a comment