Bài giảng LPI202 - Chapter 01 Advanced Linux Network Administration

Tài liệu Bài giảng LPI202 - Chapter 01 Advanced Linux Network Administration: Networking Configuration Chapter 01Advanced Linux Network Administration ObjectivesNetworking configurationShould be able to configure a network device to be able to connect to a local network and a wide-area network. To be able to communicate between various subnets within a single networkNetworking utilitiesLinux Networking DriversAn Ethernet driver is typically compiled into the kernel, but may be loaded as a kernel module at boot time. InterfacesThe Ethernet card interface is typically named "eth0". The loopback interface is typically named "lo"./sbin/ifconfig -a will show all interfaces./sbin/ifconfig eth0 will show just the primary Ethernet card interface. Configuration Files All of these are in /etc./etc/sysconfig/network Define whether to activate networking on boot and define the hostname of the machine. /etc/sysconfig/network-scripts/ifcfg-loConfigures the loopback interface (to 127.0.0.1) -- this interface allows you to use TCP/IP software without being connected to a LAN. ...

ppt17 trang | Chia sẻ: honghanh66 | Lượt xem: 804 | Lượt tải: 0download
Bạn đang xem nội dung tài liệu Bài giảng LPI202 - Chapter 01 Advanced Linux Network Administration, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
Networking Configuration Chapter 01Advanced Linux Network Administration ObjectivesNetworking configurationShould be able to configure a network device to be able to connect to a local network and a wide-area network. To be able to communicate between various subnets within a single networkNetworking utilitiesLinux Networking DriversAn Ethernet driver is typically compiled into the kernel, but may be loaded as a kernel module at boot time. InterfacesThe Ethernet card interface is typically named "eth0". The loopback interface is typically named "lo"./sbin/ifconfig -a will show all interfaces./sbin/ifconfig eth0 will show just the primary Ethernet card interface. Configuration Files All of these are in /etc./etc/sysconfig/network Define whether to activate networking on boot and define the hostname of the machine. /etc/sysconfig/network-scripts/ifcfg-loConfigures the loopback interface (to 127.0.0.1) -- this interface allows you to use TCP/IP software without being connected to a LAN. /etc/sysconfig/network-scripts/ifcfg-eth0 Configures the primary Ethernet interface. IP Network ConfigurationsTwo choices: Static IP addressDynamic IP address(a) Static IP address -- useful for servers Example: Mike's notebook configured as a server/etc/sysconfig/network NETWORKING=yes HOSTNAME=gojira.l17.cit-ncaat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 ONBOOT=yes IPADDR=192.168.93.254 NETMASK=255.255.255.0 GATEWAY=192.168.93.1 IP Network Configurations(b) Dynamic IP address -- using DHCP Example: Mike 's notebook configured as a mobile workstation using DHCP. /etc/sysconfig/network NETWORKING=yes HOSTNAME=gojira /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yesSupport Files/etc/hosts -- Lists static IP addresses and hostnames. Example:# Do not remove the following line, or various programs # that require network functionality will fail.127.0.0.1 localhost.localdomain localhost 192.168.90.157 gojira/etc/resolv.conf -- Lists files, domains, and DNS servers to search to convert hostnames to IP addresses. Example: ; generated by /sbin/dhclient-script search cogeco.ca nameserver 192.168.0.1 Shell Script To Control Networking/etc/init.d/network Started by init when the system starts. You may also run it as "root" with any one of these following options:/etc/init.d/network start /etc/init.d/network stop /etc/init.d/network restart /etc/init.d/network reload /etc/init.d/network status Common Utilities: pingpingThe ping command allows the user to test whether or not a network connection is active, the speed of that connection, and how a network behaves given specific data loads.ping IP-address Example: ping 203.162.44.34When the ping command is finished (or you manually stop it with CTRL-C):a minimum timeAverage timemaximum timepercentage of packets that may have been lost.is calculatedCommon Utilities: ifconfigifconfig also: ifcfg, ifup, ifdown, ethtool The ifconfig command is a tool used to display and configure network interfaces. Examplesifconfig eth0 192.168.20.21 netmask 255.255.255.0ifconfig eth0 upifconfig eth0 downifconfig -aCommon Utilities: hostnamehostname also: domainname, dnsdomainname The hostname command tells you what the hostname of your machine is set to. The hostname is determined from a number of sources, such as the /etc/sysconfig/network or /etc/hosts files.Example[root@proserv root]# hostname proserv[root@proserv root]# hostname webserv[root@proserv root]# hostname webserv[root@proserv root]# domainname vnu-itp.edu.vn[root@proserv root]# domainname vnu-itp.edu.vnCommon Utilities: nslookupnslookup,host,dig These commands query the DNS database to determine information about network hosts.Example$nslookup www.yahoo.com$nslookup >set type=any >vnn.vn$host www.vnn.vn$digCommon Utilities: traceroutetraceroute also: tracepath This program prints the route along which an IP packet travels from the local host to reach the destination host.Example:root@sleipnir root]# traceroute www.ibm.com1  dvalin (192.168.168.252)  0.739 ms  0.364 ms  0.265 ms2  midgard.lesbell.com.au (203.35.202.158)  1.890 ms  1.315 ms  1.292 ms3  Loopback1.ken10.Sydney.telstra.net (165.228.2.1)  17.909 ms  19.071 ms  19.581 ms4  10GigabitEthernet15-0.ken-core4.Sydney.telstra.net (203.50.20.1)  31.446 ms  208.883 ms  171.406 ms5  10GigabitEthernet3-0.pad-core4.Sydney.telstra.net (203.50.6.86)  20.327 ms  20.912 ms  18.271 ms6  GigabitEthernet2-2.syd-core01.Sydney.net.reach.com (203.50.13.38)  20.309 ms  20.360 ms  19.721 ms7  i-12-2.wil-core01.net.reach.com (202.84.144.25)  169.611 ms  170.647 ms  168.839 ms8  202.84.251.166 (202.84.251.166)  191.602 ms  188.565 ms  177.935 ms9  so-1-0.core2.LosAngeles1.Level3.net (64.152.193.65)  201.521 ms  200.113 ms  202.050 ms10  so-4-1-0.bbr2.LosAngeles1.Level3.net (4.68.113.173)  201.732 ms  201.403 ms  201.674 ms11  so-3-0-0.mp1.Denver1.Level3.net (64.159.1.113)  228.770 ms  227.226 ms  229.076 ms12  so-6-0.hsa1.Denver1.Level3.net (4.68.112.154)  228.021 ms  228.383 ms  237.262 ms13  unknown.Level3.net (209.245.20.10)  226.879 ms  228.772 ms  230.193 msCommon Utilities: routeThe routing tables are configured, checked and changed with the /sbin/route tool. Add a static route:/sbin/route add -net 10.0.0.0 gw 192.168.1.108 dev eth1 Add a default gateway:/sbin/route add default gw 192.168.1.1 eth0Listing the kernel routing table: /sbin/route -nArp, arpwatcharp also: arping The arp command by itself is used to view the information currently in the ARP table (Address Resolution Protocol). This table maps the IP address of machines on your network segment with their MAC address.Example[root@proserv root]# arp -a-bash: child setpgid (893 to 893): No such process? (10.11.2.219) at 4C:00:10:38:AB:C6 [ether] on eth0? (10.11.1.7) at 00:10:B5:CC:9D:75 [ether] on eth1? (10.11.2.104) at 4C:00:10:60:2F:BB [ether] on eth0? (10.11.1.1) at 00:07:85:A3:32:A1 [ether] on eth1? (10.11.2.79) at 4C:00:10:71:AC:8B [ether] on eth0? (10.11.1.8) at 00:0F:EA:6A:2A:C2 [ether] on eth1? (10.11.1.23) at 00:0C:6E:45:57:45 [ether] on eth1netstatnetstatThe netstat command displays details about the network:routing tables and other interface statistics. Active Internet Connections.Example[root@proserv root]# netstat -an|moreActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 10.11.1.2:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN tcp 0 0 10.11.1.2:445 10.11.2.197:1055 ESTABLISHED tcp 0 192 10.11.1.2:22 10.11.2.83:49334 ESTABLISHED SummaryNetworking configurationto configure a network device to be able to connect to a local network and a wide-area network. To be able to communicate between various subnets within a single networkTest connection with other hosts

Các file đính kèm theo tài liệu này:

  • pptlpi202_c1_networking_688f2_2207.ppt
Tài liệu liên quan