80 likes | 221 Views
Configuring TCP/IP. Configuring a network interface. In Unix there are essentially two commands that are used to enable TCP/IP. Ifconfig – (Interface Configuration) Route -Adds a network route. ifconfig eth0. eth0 Link encap:Ethernet HWaddr 00:03:FF:02:95:3E
E N D
Configuring a network interface • In Unix there are essentially two commands that are used to enable TCP/IP. • Ifconfig – (Interface Configuration) • Route -Adds a network route
ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:03:FF:02:95:3E inet addr:192.168.131.66 Bcast:192.168.131.255 Mask:255.255.255.0 UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1 RX packets:793 errors:3 dropped:0 overruns:0 frame:0 TX packets:477 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1032832 (1008.6 Kb) TX bytes:30910 (30.1 Kb) Interrupt:11 Base address:0xec00
Creating an Interface • ifconfig eth0 192.168.0.22 netmask 255.255.255.0
Running DHCP • To obtain an IP address from a DHCP server one would use dhcpcd(Client Daemon) • dhcpcd ethX • Where X is the network interface number.
Specifying a DNS Server • /etc/resolv.conf • This file would contain the following; • Nameserver <IP OF DNS SERVER>
Adding a route • The following are sample route commands. • route add –net 192.168.5.0 netmask 255.255.255.0 eth0 • Adds a route to the 192.168.5.0/24 network (no gateway)
Route example (Con’t) • Route add –net 192.168.22.0 netmask 255.255.255.0 gw 192.168.22.5 eth0 • Adds a route to the 192.168.22.0/24 network with 192.168.22.5 as a gateway. • Route add default gw 192.168.0.1 • Sets 192.168.0.1 as the default gateway