Networking Basics
Ngô Văn Công
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)
Nội dung
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, 192.168.0.0-192.168.255.0 Loopback address: 127.0.0.1
Cơ 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):
Loopback device: lo Ethernet devices: eth0, eth1 PPP devices: ppp0, ppp1
Các thiết bị mạng
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)
Cấu hình mạng TCP/IP
/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)
Cô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)
Cấu hình thiết bị mạng
Loading device driver # modprobe 3c509
Configuring device: ifconfig
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
/etc/host.conf
Cấu hình bộ phân giải tên(DNS)
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
Routing tables # route -n # netstat -rn
Configuring default route
Cấu hình định tuyến
# route add default gw 172.29.9.254 eth0
# 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
/etc/network/interfaces
ifconfig nslookup ping Traceroute ethtool netstat
Các công cụ quản lý mạng
$ ifconfig -a $ nslookup moon $ ping moon $ traceroute moon $ netstat -an
Network ports Network daemons Network clients Text-based protocols
Các ứng dụng mạng
A 16-bits number 0-1023: privileged ports Reserved ports: /etc/services
Ports
service-name port/protocol aliases
A program listened and served specified
service
Started by
startup scripts (standalone)
Network Daemons
telnet ftp ssh
Network Clients
FTP (command) SMTP HTTP POP3/IMAP NNTP
Text-based Protocols
NFS là gì? Gắn kết hệ thống NFS Xuất bản(export) hệ thống NFS
Network File System
Cơ chế chia sẻ tập tin trong các hệ thống Unix Được sử dụng bởi các người dùng trong mạng
LAN (LAN)
Truy cập trong suốt Có trên hâu hết các hệ thống Unix
NFS là gì?
/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
Xuất bản hệ thống tệp NFS
-a: export or unexport all directories -u: unexport one or more directories -r: reexport all directories # exportfs -av
dùng câu lệnh
Mounting NFS Filesystems
# mount -t nfs oscar:/export/project /mnt/data
/etc/fstab