Cấu hình việc quản lý tên của server Đ/c: /etc/resolv.conf. Gồm[r]
Trang 1Quản trị Linux
Quản trị Linux trên LAN
Mạng TCP/IP
Cài đặt, quản lý các dịch vụ LAN
Lập trình với shell script
Trang 3Thiết lập Interface cho NIC
Hay công cụ GUI theo từng distro
Dùng DHCP (IP được cấp bởi DHCP server)
Tồn tại 1 DHCP server đang chạy
Trang 4Thiết lập Interface cho NIC - ifconfig
Trang 5Thiết lập Interface cho NIC - ifconfig
Thao tác trên các interface
Trang 6Thiết lập Interface cho NIC - ifconfig
Thao tác trên các interface
Hiển thị tất cả cấu hình
Tệp /etc/sysconfig/network-scripts/ifcfg-<interface>
Ví dụ: cat /etc/sysconfig/network-scripts/ifcfg-eth0
Trang 7Ip command
Trang 8IP v6
Trang 9IP Aliasing
single host to have multiple IP addresses
Each interface in Linux system can have multiple IP addresses assigned
Same Windows
eth0 is the main interface,
eth0:0 is aliased interface,
eth0:1 is aliased interface,
Trang 10IP Aliasing
Trang 12Thiết lập Route - Minimal
Trang 13Thiết lập Route - Static
-net <interface của net>: -net 192.168.100.0/24
-host <IP của host>
Trang 14Thiết lập Route - Static
Route – Ví dụ
Tạo route mặc định cho hệ thống
Route add default gw 172.16.12.1
Thêm 1 route cho mạng LAN
Route add –net 192.168.100.0/24 gw 192.168.2.1 eth0
Route add –net 172.16.1.0 netmask 255.255.255.0 gw 192.168.2.1 eth0
Trang 15Classless interdomain routing
classes use of address space
waste some addresses
Ex: class C address space to a certain university campus
inefficient
Solution
no restriction on classes, emerged
Classless interdomain routing (CIDR)
Trang 16Classless interdomain routing
allow variable-length prefix
to represent network ID
remaining bits of 32-field address represent hosts within network
For example
1 organization use 20-bit network ID
another organization use 21-bit network ID
with first 20 bits of these 2 network IDs is identical
address space of 1organization contains that
of another one
Trang 17router using CIDR address space
increase in speed of routers
greatly reduced size of routing tables
Supernetting (for routing table)
a single routing entry a group of adjacent addresses
2 entries with same prefix router chooses between entries, using longest-prefix-match technique
Trang 18router using CIDR address space
Assume that a packet with destination IP
205.101.0.1 is received by router R1
In entries of this router, 2 routes,
L1 205.101.8.0/20
L2 205.101.0.0/21
CIDR choose longer prefix be eligible match
link L1, with its 21-bit prefix,
This link eventually routes packet to network N3
Trang 19CIDR routing
Trang 20CIDR routing
CIDR allows us to reduce number of entries in a router's table
using aggregate technique,
all entries have some common partial prefix can
combined into 1 entry
Trang 22Install
Trang 23Install on ubuntu
sudo apt-get install dhcp3-server
Trang 24Download & Install
http://ftp.isc.org/isc/dhcp/dhcp-4.1.0a1.tar.gz
Trang 25Thiết lập DHCP
DHCP server -/etc/dhcpd.conf
Trang 26Dhcpd.conf
Trang 27Common dhcpd.conf Options
Trang 29DHCP client’s option
Trang 31Domain Name server
Được cài đặt bởi BIND (Berkeley Internet Name Domain)
Tên: named
Cấu hình
Cấu hình tệp resolve.conf
Cấu hình Bind: named.conf
Tạo các tệp CSDL cho các zone
Trang 34DNS - named.conf
Thư mục default chứa các tệp CSDL
Zone Root của DNS Zone exemple.fr -> cần tệp named.exemple.fr
Zone local của hệ thống Zone reverser
Tệp chứa mô tả root
Trang 35Domain & Zone
gets its own zone
All of zones collectively form entire domain.
Trang 36sales.example.org, and admin.example.org
Each of four subdomains has its own zone
example.org has some hosts within it
that do not fall under any of subdomains;
Thus, it has a zone of its own
“example.org” domain is actually composed of five zones in total
Trang 37Primary servers
ones considered authoritative for a particular domain
primary name server for a domain is
a DNS server that knows about all hosts and subdomains existing under its domain.
Trang 38root name servers
act as the first port of call for topmost
parts of domain namespace.
root zone file describes where authoritative servers for DNS top-level domains
Trang 39DNS - named.conf
Tệp named.exemple.fr
Tên của PC dùng làm server của zone
Trang 40DNS –Các tệp named
Named.local
Dùng để đổi IP: 127.0.0.1 thành localhost
Thuộc zone 0.0.127.IN-ADDR-ARPA (zone reverse)
Trang 42DNS –Các tệp named
Named.rev
Dùng để đổi IP thành tên& ghi các PTR
Trang 45Các công cụ TEST
Netstat
Xem trạng thái của TCP/IP, NIC
Option thông dụng
-I : thông tin về NIC
-nr: thông tin về route
Traceroute <host | NET>
Hiển thị lộ trình đi đến 1 host hay LAN đích
Trang 46NIS
Trang 48NIS server
Trang 49NIS server- install
Trang 50NIS install
Trang 511 Domain name
Trang 52Start NIS
Trang 53Edit makefile
Designating Slave Servers: NOPUSH
Minimum UIDs and GIDs: MINUID and
Trang 544 Ypinit
Trang 55Config client NIS
Trang 56Editing the /etc/yp.conf File
Trang 57Enabling and Starting ypbind
Trang 58EDITING THE
/ETC/NSSWITCH.CONF
Trang 59NIS working
Trang 60Quản trị Linux
Quản trị Linux trên LAN
Mạng TCP/IP
Cài đặt, quản lý các dịch vụ LAN
Chia sẻ tài nguyên
NFS, Máy in
Samba
Mail server: Sendmail, Postfix
Web server: Apache
Proxy
Client- server VNC
Nhập môn bảo mật
IP table, công cụ ipchains
Lập trình với shell script
Trang 61Chia sẻ tài nguyên - NFS
Network File System
Client –server dùng chia sẻ các tệp giữa các hệthống Linux
Trang 62Chia sẻ tài nguyên - NFS
Cài đặt
Server
Gói APP nfsd (Fedora)
Dùng rpm với đĩa cài đặt Linux (nếu là PC workstation)
Xác định& khởi động tiến trình portmap dùng cho các RPC
Trang 63ENABLING NFS IN FEDORA
Trang 65NFS on Ubuntu
Trang 66NFS - Cài đặt
Tệp cấu hình /etc/exports
Mô tả các tài nguyên cần chia sẻ
Nội dung
Mỗi tài nguyên: 1 dòng
<Tên tài nguyên> <IP|tên PC client> (options)
Tên tài nguyên
Path đến thư mục, tên mô tả thiết bị (máy in)
IP| tên PC client
PC Client phải được phép truy cập hệ thống với /etc/hosts.allow
Trang 67Chia sẻ tài nguyên – NFS - Cài đặt
Trang 69exportfs
Trang 70NFS server configuration utility
Trang 71showmount Command
Trang 74Chia sẻ tài nguyên - NFS
Trang 75Chia sẻ tài nguyên - NFS
Trang 76NFS Client
Trang 79Chia sẻ tài nguyên – Máy in
Dùng Printer Configurator
Cài đặt máy in kiểu UNIX thay cho local
Chỉ địa chỉ của remote printer (PC!printer)
Tệp /etc/printcap
Khai báo remote printer
Option: rm=<IP|tên>:rp=tên máy in
Máy in đã được khai báo
Ví dụ
Lw:\
:lp=:rm=bean:rp=Hplaser:\
Trang 80Chia sẻ tài nguyên – Samba
App Client –Server
Chia sẻ tài nguyên (tệp, máy in) giữa các hệ thống Windows
Trang 81Chia sẻ tài nguyên – Samba
Trang 82Chia sẻ tài nguyên – Samba
Trang 83Chia sẻ tài nguyên – Samba
Tệp /etc/samba/smb.conf
Trang 84Chia sẻ tài nguyên – Samba
Tệp /etc/samba/smb.conf
Global
Security: cấp độ bảo mật (thường dùng: user)
Smb passwd file: nơi đặt file chứa thông tin password
Path: Đ/c của thư mục chia sẻ
Readonly | Writeable: (yes/no)
Browseable: (yes/no) cho phép browse (không) thư mục
Create mask: định nghĩa ATTR tệp được người dùng tạo
Directory mode: định nghĩa ATTR thư mục được người dùng tạo
Trang 85Chia sẻ tài nguyên – Samba
Trang 86Chia sẻ tài nguyên – Samba
Trang 87Selected Samba Commands
Trang 89Remote access using mount
Trang 90SMBFS
Trang 91SMB users
Trang 92A Basic Domain Member
In smb.conf
security = server
password server = <NT Server Name>
Part of an Active Directory
Network
security = ads
Trang 93Chia sẻ tài nguyên – Sendmail
Trang 94Chia sẻ tài nguyên – Sendmail
Cấu hình sendmail (sendmail.cf)
Cấu hình trung gian với tệp /etc/mail/sendmail.mc
Dùng macro m4 để sinh tệp sendmail.cf
m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
Khởi động lại sendmail
/sbin/service sendmail restart
Các tệp cấu hình trong /etc/mail
Trang 95Chia sẻ tài nguyên – Sendmail
Machine đóng vai trò gateway cho hệ thống mail
Chứa trong tệp /etc/mail/local-hosts-names
Ví dụ: PC mail.bigcorp.com là gw
Trang 96Chia sẻ tài nguyên – Sendmail
Các PC torgo, poodle, khai báo gw trong
sendmail.cf với option DM, DH
Trang 97Chia sẻ tài nguyên – Sendmail
Dùng mail với LDAP
Lightweight Directory Access Protocol
Tìm nhanh 1 user trên 1 domain rộng
Với sendmail
Dùng kết quả của LDAP trong xác định đ/c mail.
Khởi động với sendmail LDAP
Cài đặt & cấu hình đúng LDAP (OpenLDAP)
Thêm vào sendmail.cf khai báo LDAP
Trang 98Chia sẻ tài nguyên – Sendmail
Trang 99Apache – Tổng quan
Web server khả chuyển
Trên nhiều OS khác nhau
Trên Redhat - Linux
Gói APP: apache.rpm
Tác vụ
Cài đặt apache server
Khởi động web server
Cấu hình apache server
Trang 100Apache – Cài đặt server
Trang 101Apache – Khởi động server
Cấu hình với GUI
System/ Apache Configurator
Trang 102Apache – Cấu hình apache
Trang 103Apache – Cấu hình httpd.conf
Trang 104Apache – Cấu hình apache
Các option
ServerType
Quy định cách khởi động apache
Standalone: như 1 daemon độc lập
Xinetd: qua xinetd
Trang 105Apache – Cấu hình apache
Allow (hay Deny)
Định các client có (không) quyền truy cập
</Directory>
Trang 106Apache – Cấu hình apache
Các khai báo
Mô tả thư mục tương đối trong document Root
Trang 107Apache – Cấu hình apache
Các khai báo
Mô tả host virtual
<VirtualHost đ/c ip | host name>
Trang 108Apache – Cấu hình apache
Các khai báo
Mô tả host virtual
Trang 109Apache – Cấu hình apache
access.conf
Định nghĩa cách truy cập toàn cục cho người dùng
Mỗi directory có thể định nghĩa kiểu riêng
Dùng khi cần bảo mật doc với người dùng
Trang 110Apache – Cấu hình apache
Trang 111Virtual Network Computing
Remote access với GUI
Hai trường hợp dùng remote access
Client – server có cùng OS (Linux)
Một chức năng của Linux
Ví dụ: start prog từ PC bean và hiển thị nó trên màn hình (default) của PC quang
/prog –display quang:0
Client –Serveur khác OS (Windows, Linux)
Serveur: Linux
Client: Windows
Dùng VNC
Trang 113VNC – Cài đặt & sử dụng Server
Sửa đổi ~/.vnc/xstartup: chọn X env
Startgnome hay startkde
Trang 114VNC – Cài đặt & sử dụng Client
Trang 115create database using mySQL
Trang 116Start
using /etc/rc.d/init.d/mysql start
Trang 117MySQL - working
Logon
mysql -u root mysql
running server with mysqladmin command
mysqladmin -u root version
mysqladmin -u root password
newpassword
Trang 118Working
Trang 120Working – create database
Trang 121Working – create table
Trang 122Working – insert data
Trang 123Configure MySQL for Websites
review the list is with the following
command:
cache search mysql | grep apache
Trang 124MySQL
Trang 127Administrator
Trang 129Users
Trang 130mysqladmin
Trang 131Creating a Database
Trang 132Create table
Trang 133Insert data
Trang 134MySQL Control Center
Trang 135Connect to server