Bài giảng Hệ điều hành linux: Chương 7 Networking Basics do Ngô Văn Công biên soạn cung cấp các kiến thức cơ bản như: Cơ bản về giao thức TCP/IP, các thiết bị mạng, cấu hình mạng TCP/IP, công cụ quản lý mạng, ứng dụng mạng, network File System (NFS).
Trang 1Networking Basics
Ngô Văn Công
Trang 2Nội dung
Cơ bản về giao thức TCP/IP
Các thiết bị mạng
Cấu hình mạng TCP/IP
Công cụ quản lý mạng
Ứng dụng mạng
Network File System (NFS)
Trang 3Cơ bản về giao thức TCP/IP
IP address: 172.29.9.10/255.255.255.0
Hostname: oscar
Full Qualified Domain Name (FQDN):
oscar.hcmuns.edu.vn
Name resolution: map name to ip address (DNS)
Routing
Protocols: TCP, UDP, ICMP, ARP, BOOTP, DHCP, DNS, FTP,
RPC, NFS
Private address: 10.0.0.0/8, 172.16.0.0-172.31.0.0,
Trang 4Các thiết bị mạng
Loopback device: lo
Ethernet devices: eth0, eth1
PPP devices: ppp0, ppp1
Trang 5Cấu hình mạng TCP/IP
Công cụ và các tập tin cấu hình cần thiết
Cấu hình thiết bị mạng(network interface)
Cấu hình bộ phân giải tên(DNS)
Cấu hình định tuyến(Routing)
Trang 6Công cụ và tập tin cấu hình
mạng
Công cụ dòng lệnh: ifconfig, route
Các tập tin cấu hình mạng(ubuntu)
/etc/network
/etc/network/interfaces
Các tập tin phân giải tên
/etc/hosts
/etc/resolv.conf
Các tập tin khởi động
/etc/init.d/networking
Công cụ đồ họa: network-admin(ubuntu)
Trang 7Cấu hình thiết bị mạng
# modprobe 3c509
ifconfig device IP_address netmask net_mask [up]
# ifconfig eth0 172.29.9.112 netmask 255.255.255.0 up
# ifconfig lo 127.0.0.1
# ifconfig eth0 down
Trang 8Cấu hình bộ phân giải tên(DNS)
/etc/host.conf
order hosts,bind
/etc/hosts
127.0.0.1 localhost
172.29.9.254 ntu.edu.vn
/etc/resolv.conf
domain ntu.edu.vn
nameserver 172.29.9.1
nameserver 172.29.2.1
Trang 9Cấu hình định tuyến
Routing tables
# route -n
# netstat -rn
Configuring default route
# route add default gw 172.29.9.254 eth0
Trang 10# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.33
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
# dns-* options are implemented by the resolvconf package, if installed dns-nameservers 193.79.237.39
Trang 11Các công cụ quản lý mạng
ifconfig
nslookup
ping
Traceroute
ethtool
netstat
$ ifconfig -a
$ nslookup moon
$ ping moon
$ traceroute moon
$ netstat -an
Trang 12Các ứng dụng mạng
Network ports
Network daemons
Network clients
Text-based protocols
Trang 13 A 16-bits number
0-1023: privileged ports
Reserved ports: /etc/services
service-name port/protocol aliases
Trang 14Network Daemons
A program listened and served specified service
Started by
startup scripts (standalone)
Trang 15Network Clients
telnet
ftp
ssh
Trang 16Text-based Protocols
FTP (command)
SMTP
HTTP
POP3/IMAP
NNTP
Trang 17Network File System
NFS là gì?
Gắn kết hệ thống NFS
Xuất bản(export) hệ thống NFS
Trang 18NFS là gì?
LAN (LAN)
Trang 19Xuất bản hệ thống tệp NFS
/etc/exports controls exported filesystems
directory hostname(options)
/mnt/software ws1.lab.hcmuns.edu.vn(ro)
/export/home *.lab.hcmuns.edu.vn(rw)
exportfs - maintain list of NFS exported file systems
-a: export or unexport all directories
-u: unexport one or more directories
-r: reexport all directories
# exportfs -av
Trang 20Mounting NFS Filesystems
dùng câu lệnh
# mount -t nfs oscar:/export/project /mnt/data
/etc/fstab
oscar:/export/project /mnt/data nfs timeo=20,intr