Tải bản đầy đủ (.pdf) (20 trang)

Bài giảng Hệ điều hành linux: Chương 7 - Ngô Văn Công

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (127.55 KB, 20 trang )

Networking Basics
Ngô Văn Công


Nộ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)


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):
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ác thiết bị mạng




Loopback device: lo
Ethernet devices: eth0, eth1
PPP devices: ppp0, ppp1


Cấ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)


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ác tập tin phân giải tên





/etc/hosts
/etc/resolv.conf


Các tập tin khởi động




/etc/network
/etc/network/interfaces

/etc/init.d/networking

Công cụ đồ họa: network-admin(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


Cấ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


Cấu hình định tuyến


Routing tables





# route -n
# netstat -rn

Configuring default route

# route add default gw 172.29.9.254 eth0


/etc/network/interfaces
# 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


Cá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


Các ứng dụng mạng





Network ports
Network daemons
Network clients
Text-based protocols


Ports




A 16-bits number
0-1023: privileged ports
Reserved ports: /etc/services

service-name port/protocol aliases


Network Daemons


A program listened and served specified
service



Started by


startup scripts (standalone)


Network Clients




telnet
ftp
ssh


Text-based Protocols







FTP (command)
SMTP
HTTP
POP3/IMAP
NNTP


Network File System




NFS là gì?
Gắn kết hệ thống NFS
Xuất bản(export) hệ thống NFS


NFS là gì?






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


Xuấ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


Mounting 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



×