
17
Manually setup static IP and
routing by hand
TEMPORARY SETUP
This will NOT last through
a reboot
Example:
NIC Information:
IP address = 192.168.0.10
Subnet Mask = 255.255.255.0
Gateway = 192.168.0.1
Hostname = mypc.acme.com
DNS = 192.168.0.77
1. Configure the NIC and IP address with the ifconfig command:
ifconfig eth0 192.168.0.1 netmask 255.255.255.0 broadcast
192.168.0.255
(If you’re dealing with a PCMCIA NIC, you be able to get a report of
the IRQ and IO values by typing cardctl config)
2. Create the local route:
route add –net 192.168.0.0 netmask 255.255.255.0 dev eth0
3. Create the local gateway:
route add default gw 192.168.0.1
Static IP Address
PERMANENT SETUP
This will last through a
reboot
Use the networking file for the specific interface. For eth0, use
/etc/sysconfig/network-scripts/ifcfg-eth0
For DHCP the file looks like:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
For STATIC the file looks like:
DEVICE=eth0
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
GATEWAY=192.168.1.1
BOOTPROTO=none
ONBOOT=yes
Then:
1. Set the hostname:
vi /etc/sysconfig/network
HOSTNAME=”mypc.acme.com”
2. Enter hosts file information:
vi /etc/hosts
192.168.0.10 mypc.acme.com mypc
3. Enter the DNS server information:
vi /etc/resolv.conf
nameserver 192.168.0.77
Commenti su questo manuale