160 likes | 394 Views
Linux. Setting up your network. Basic Approaches. Configure during installation Disadvantage -> not able to redo easily Advantage-> holds your hand Configure after installation Disadvantage -> collision with other config tools Advantage-> fairly easy to use (99.5% coverage)
E N D
Linux Setting up your network
Basic Approaches • Configure during installation • Disadvantage -> not able to redo easily • Advantage-> holds your hand • Configure after installation • Disadvantage -> collision with other config tools • Advantage-> fairly easy to use (99.5% coverage) • Access files directly • Disadvantage -> more details to know • Advantage-> access to everything and a deeper understanding
Access Files Directly • Most of the files are in /etc • Use installation to recognize NIC cards • /etc/sysconfig to specify setup • /etc/modules.conf to recognize cards • /etc/rc.d/init.d to restart network after configuring • Add manual routes to static-routes
/etc • Tons of configuration information • Very small amount related to the configuration of the network • Focus on /etc/sysconfig first • Use the installation process to recognize the NIC cards. • Edit sysconfig files afterwards if errors occur.
Recognizing cards • Installation is reasonably sophisticated. • Most cards will be recognized either with a generic driver or the real one. • Use ifconfig to determine if card is recognized. (see next overhead) • For older cards use /etc/modules.conf
ifconfig-> eth0 Link encap:Ethernet HWaddr 00:E0:7D:7A:AE:2C inet addr:192.168.1.77 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:107551 errors:0 dropped:0 overruns:0 frame:0 TX packets:146864 errors:0 dropped:0 overruns:0 carrier:0 collisions:6947 txqueuelen:100 RX bytes:12906086 (12.3 Mb) TX bytes:27598982 (26.3 Mb) Interrupt:5 Base address:0xe000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1269 errors:0 dropped:0 overruns:0 frame:0 TX packets:1269 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:111800 (109.1 Kb) TX bytes:111800 (109.1 Kb)
Cards Recognized .. Next? • Check the configuration of the network • Use netstat to check the routing tables • Be sure the cards are connected to the right network if multiple cards (router) • Use ping to check for connectivity.
netstat -nr [root@testmachine]#netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 40 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo 0.0.0.0 192.168.1.1 0.0.0.0 UG 40 0 0 eth0
Problems? General Networking • Examine the network configuration files / [prompt]#cat network NETWORKING=yes FORWARD_IPV4=false HOSTNAME=testserver DOMAINNAME=localdomain GATEWAY=192.168.1.1 [prompt]# … etc sysconfig network
Red Hat Fedora exceptionto network file • Format is same but… • FORWARD_IPV4 flag is overridden by an entry in a kernel configuration file named /etc/sysctl.conf • net.ipv4.ip_forward = 1
Each Device / [prompt]#cat ifcfg-eth0 DEVICE=eth0 BOOTPROTO=static IPADDR=192.168.1.77 NETMASK=255.255.255.0 NETWORK=192.168.1.0 BROADCAST=192.168.1.255 ONBOOT=yes [prompt]# … etc sysconfig network network-scripts … ifcfg-eth0
Recognizing a NIC /etc/modules.conf alias eth0 ne2k-pci alias eth1 3c5x9 options ne2k-pci irq=5 • Forces the boot programs to examine additional “modules” for support in recognizing devices. • Modules do other things and generally add functionality to the kernel. • Odd format, but says to probe for a device using the ne2000 probe and name it eth0. • Lets you control naming and also deal with two cards with • identical type (not plug and play) • Lets you add other info to help the probe software detect the device (specifying interrupt and i/o settings)
Other issues in recognizing • Two cards of the same type are problematic if using older ISA cards • Most plug and play work fine • Is same and older • May need to use separate software to set I/O • And to set INTERRUPT • Then use modules.conf to convey setting to boot. • Look online for details for setting modules for specific network card types.
Restarting the network / … • This is a script used during the boot process to start up the network. • Don’t change it! • Restart the network by • cding to the /etc/rc.d/init.d directory • ./network restart etc rc.d init.d network
ping • Don’t forget to use ping to test connectivity • Use the lights to be sure interfaces are connected • Use ifconfig to track the progress of communications • through each interface • “inch” your way out (pinging) if outside connection fails • Be sure to configure forwarding on your router in the /etc/sysconfig/network file