Bài giảng Quản trị Linux cung cấp những kiến thức cơ bản về networking - CentOS. Những nội dung chính được trình bày trong chương này gồm có: network configuration and information, network configuration commands. Mời các bạn cùng tham khảo.
Đặng Thanh Bình Networking - CentOS Contents • Network configuration and information • Network configuration commands NETWORK CONFIGURATION AND INFORMATION Config Of Network Interfaces • Ubuntu configuration is done selecting System>Administration->Networking • RedHat/CentOS: redhat-config-network – has both a graphical and a text mode interface • Mandrake/Mandriva: Network and Internet Configuration Wizard • GNOME systems: gnome-network-preferences • KDE systems: knetworkconf Network Interface Names • lo or the local loop is linked with the internal 127.0.0.1 address • eth0: a standard network interface card • ppp0: the modem Network Configuration Files • /etc/hosts Network Configuration Files • /etc/resolv.conf – Configure access to a DNS server • /etc/nsswitch.conf – Define the order in which to contact different name services For Internet use, it is important that dns shows up in the "hosts" line: Network Configuration Files • /etc/sysconfig/network – Định nghĩa cấu hình network cho máy tính enable network enable network IPv6 tên máy tính so sánh với giá trị /etc/hosts default gateway máy tính Network Configuration Files • ifcfg-eth[n] – Each network card has a configuration file in /etc/sysconfig/network-scripts/ifcfg-eth[n] – n: start from – Loopback card config file ifcfg-lo tên card mạng gán IP tĩnh, DHCP active boot Network Configuration Files • /etc/services – File /etc/services gồm danh sách network port service sử dụng port – Khi định nghĩa service mới, người quản trị phải định nghĩa cặp service name port number vào file /etc/services – Port – 1024: port dành riêng – Port > 1024: port định nghĩa thêm vào tùy theo nhu cầu ứng dụng NETWORK CONFIGURATION COMMANDS ip command • Assigning IP addresses to interfaces • Setting up routes to the internet and to other networks • Displaying TCP/IP configurations • … ip command ifconfig command • Displaying network interface information ifconfig command • Display details of all interfaces including disabled interfaces # ifconfig -a • Disable an Interface # ifconfig eth0 down • Enable an Interface # ifconfig eth0 up ifconfig command • Assign ip-address to an Interface # ifconfig eth0 192.168.2.2 • Change Subnet mask of the interface eth0 # ifconfig eth0 netmask 255.255.255.0 • Change Broadcast address of the interface eth0 # ifconfig eth0 broadcast 192.168.2.255 • Assign ip-address, netmask and broadcast at the same time to interface eht0 # ifconfig eth0 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255 ifconfig command • Change MTU – MTU is the maximum number of octets the interface is able to handle in one transaction – For Ethernet the Maximum transmission unit by default is 1500 # ifconfig eth0 mtu NUMBER ifup, ifdown command • Lệnh ifup dùng để enable interface • Lệnh ifdown dùng để disable interface netstat command • Checking the host configuration • Routing information can be displayed with the -nr option • ip route show host command • Display information on hosts or domains • Simlar to dig command ping command • To check if a host is alive traceroute command • Check the route that packets follow to a network host • On some systems, traceroute has been renamed to tracepath whois command • Specific domain name information can be queried using the whois command ... System>Administration- >Networking • RedHat /CentOS: redhat-config-network – has both a graphical and a text mode interface • Mandrake/Mandriva: Network and Internet Configuration Wizard • GNOME systems: gnome-network-preferences... sánh với giá trị /etc/hosts default gateway máy tính Network Configuration Files • ifcfg-eth[n] – Each network card has a configuration file in /etc/sysconfig/network-scripts/ifcfg-eth[n] – n:... /etc/services gồm danh sách network port service sử dụng port – Khi định nghĩa service mới, người quản trị phải định nghĩa cặp service name port number vào file /etc/services – Port – 1024: port dành