1. Trang chủ
  2. » Luận Văn - Báo Cáo

Bài thực hành số 5 môn học hệ Điều hành window và linux

21 0 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Bài Thực Hành Số 5 Môn Học: Hệ Điều Hành Window Và Linux
Tác giả Chu Đức Duy
Người hướng dẫn B22DCAT055, Quản Trọng Thế
Trường học Học Viện Công Nghệ Bưu Chính Viễn Thông
Chuyên ngành An Toàn Thông Tin
Thể loại Bài thực hành
Năm xuất bản 2024
Thành phố Hà Nội
Định dạng
Số trang 21
Dung lượng 5,08 MB

Nội dung

: Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead HOPTIONS="" On what interfaces should the DHCP server dhcpd serve DHCP requests?. ï Don't use options -cf or -pf he

Trang 1

HOC VIEN CONG NGHỆ BƯU CHÍNH VIỄN

THÔNG KHOA AN TOÀN THÔNG TIN

BAI THUC HANH SO 5 MON HOC: HE DIEU HANH WINDOW VA LINUX

Ho va tén:

Ma sinh viên:

04 - tổ TH 02 Quản Trọng Thế

Trang 2

Hà Nội, 11/11/2024 I.Giới thiệu chung bài thực hành

1.1 Mục đích

- Về kiến thức: Bài thực hành cung cấp cho sinh viên môi trường để áp dụng

thuyết của môn học vào thực tế

- Về kỹ năng: Sau khi thực hành xong, sinh viên có khả năng Cài đặt và quản

- Cài đặt trang web tĩnh và thực hiện việc kiểm soát truy nhập

- Cài đặt và cấu hình thành công dịch vụ Email trên máy chủ và trên máy khách

1.3 Thời gian thực hiện

chọn NAT (VMnet8) -> chọn Connect a host virtual adapter to this network ->

Apply -> OK, Hinh 2.1

Trang 3

VMnet0 Bridqed Auto-bridging - - VMnet1 Custom - - 192.168.100.0 VMnet8 NAT NAT Connected = 192.168.17.0

Add Network Remove Network Rename Network VMnet Information

O Bridged (connect VMs directly to the external network) Bridged to: Automatic

ONAT (shared host's IP address with VMs) NAT Settings

CO)Host-only (connect VMs internally in a private network)

Qa Connect a host virtual adapter to this network Host virtual adapter name: VMware Network Adapter VMnet8 (Use local DHCP service to distribute IP address to VMs Subnet IP: | 192.168.17 0 Subnet mask: | 255.255.255 0 Restore Defaults Import Export OK Cancel Apply Help

Hinh 2.1: Virtual Network Editor

- IP cua DHCP Server: 192.168.17.12

- Update: sudo apt-get update

2.1.1 Cai dat dich vu DHCP server cho PC1

- Bước 1: Cài isc-dhcp-server, Hình 2.2:

¢ G6 lénh: sudo apt-get install isc-dhcp-server

« Nhap password

:~$ sudo apt-get install isc-dhcp-server

[sudo] password for duy: ff

Hinh 2.2: Cai isc-dhcp-server

- Bước 2: Đặt IP tĩnh cho cổng ethernet

Gõ lệnh: ifconfig, để xem tên của cổng ethernet, Hình 2.3

Trang 4

duy@ubuntu: ~ Building dependency tree Reading state information Done

isc-dhcp-server is already the newest version (4.3.3-5ubuntui2.10)

, © newly installed, 0 to remove and 195 not upgraded

:~$ ifconfig Link encap:Ethernet HWaddr 00:0c:29:f2:99:2d

inet addr:192.168.17.12 Bcast:192.168.17.255 Mask:255.255.255.0 inet6 addr: fe80::b6c0:5709:71e1:eafa/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:33 errors:0 dropped:0® overruns:0 frame:0

TX packets:174 errors:0 dropped:0 overruns:0 carrier:0 collisions:0® txqueuelen: 1000

RX bytes:5400 (5.4 KB) TX bytes:30955 (30.9 KB) Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:65536 Metric:1

RX packets:846 errors:0 dropped:0 overruns:0 frame:0

TX packets:846 errors:0 dropped:0 overruns:0 carrier:0

collisions:0® txqueuelen: 1000

RX bytes:62630 (62.6 KB) TX bytes:62630 (62.6 KB)

Hình 2.3: Xem tên của cổng ethernet

e - Gõ lệnh: sudo nano /etc/network/interfaces.(Hình 2.4)

:~§ sudo nano /etc/network/interfaces

Hình 2.4: Lệnh mở file interfaces

s« - Rồi thêm dòng lệnh: auto ens33

iface ens33 inet static address 192.168.17.12 netmask 255.255.255.0 gateway 192.168.17.1

duy@ubuntu: ~ GNU nano 2.5.3 etc/defautt/1sc-dhcp- server Modified

Path to dhcpd's PID file (default: /var/run/dhcpd.pid)

HHDHCPD_PID=/var/run/dhcpd.pid

Additional options to start dhcpd with

: Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead HOPTIONS=""

On what interfaces should the DHCP server (dhcpd) serve DHCP requests?

4 Separate multiple interfaces with spaces, e.g "“ethO ethi"

IINTERFACES="ens33"

Hinh 2.5: Sua file interfaces

s Nhấn Ctrl+x để lưu -> nhấn y -> enter Hinh 2.5

- Sau đó, khởi động lại máy để lấy cấu hình mới, dùng lệnh:

Sudo reboot

- Bước 3: Chỉ định card mạng “ens33” dùng cho isc-dhcp-server

G6 lénh: sudo nano /etc/default/isc-dhcp-server Hinh 2.6:

Trang 5

Hình 2.6: Lệnh mở file isc-dhcp-server

« Thêm tên card mạng “ens33” vào dòng có INTERFACE=“” Hình 2.7

duy@ubuntu: ~ GNU nano 2.5.3 etc/defautt/1sc-dhcp- server Modified

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid)

HDHCPD_PID=/var/run/dhcpd.pid

## Additional options to start dhcpd with

ï Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead HOPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?

: Separate multiple interfaces with spaces, e.g "“ethO® ethi"

INTERFACES="ens33"

Hinh 2.7: Thém tén card mang Nhấn Ctrl+x để lưu -> nhấn y -> enter

- Bước 4: Cấu hình DHCP Server cấp IP theo dải mạng

» - Gõ lệnh: sudo nano /etc/dhcp/dhcpd.conf

# option definitions common to all supported networks

option domain-name "quantri.com";

optton domatn-nane-servers dhcpserver quantr+.con;

default-lease-time 600;

max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local

# network, the authoritative directive should be uncommented

authoritative;

« - Sau đó, tìm đến authoritative, kiểm tra xem đã bỏ # chưa

»« - Sửa lại dòng lệnh như sau:

subnet 192.168.17.0 netmask 255.255.255.0 {

range 192.168.17.10 192.168.17.30;

option domain-name-servers dhcpserver.quantri.com;

option domain-name "quantri.com";

option subnet-mask 255.255.255.0 option routers 192.168.17.1;

option broadcast-address 192.168.17.255;

Trang 6

default-lease-time 600;

max-lease-time 7200;

}

Nhấn Ctrl+x để lưu -> nhấn y -> enter, Hinh 2.10

# A slightly different configuration for an internal subnet

subnet 192.168.17.0 netmask 255.255.255.0 { range 192.168.17.10 192.168.17.30;

option domain-name-servers dhcpserver.quantri.com;

option domain-name "quantri.com";

option subnet-mask 255.255.255.0;

option routers 192.168.17.1 max-lease-time 7200;

Hosts which require special configuration options can be listed in host statements If no address is specified, the address will be allocated dynamically (if possible), but the host-specific information will still come from the host declaration

Hinh 2.10: File dhcpd.conf 2

- Budc 5: restart lai DHCP service

G6 lénh: sudo systemctl restart isc-dhcp-server

Nhap password, Hinh 2.11

:~$ sudo systemctl restart isc-dhcp-server

Hinh 2.11: Restart isc-dhcp-server

e Dé kiém tra xem DHCP service da chạy chưa, gõ lệnh:

sudo systemctl status isc-dhcp-server

:~§ sudo systemctl status isc-dhcp-server

isc-dhcp-server.service - ISC DHCP IPv4 server

: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; vendor

since Sun 2024-10-27 10:22:09 PDT; 3s ago : man:dhcpd(8)

Main PID: 1984 (dhcpd) CGroup: /system.slice/isc-dhcp-server.service

41984 dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcp 2:10 ubuntu sh[1984]: Wrote 0 leases to leases file

10 ubuntu dhcpd[1984]: Wrote © leases to leases file

10 ubuntu dhcpd[1984]: Listening on LPF/ens33/00:0c:29:77:56:52/192

10 ubuntu sh[1984]: Listening on LPF/ens33/00:0c:29:77:56:52/192.16 :10 ubuntu sh[1984]: Sending on LPF /ens33/00:0c:29:77:56:52/192.16 :10 ubuntu sh[1984]: Sending on Socket/fallback/fallback-net

10 ubuntu dhcpd[1984]: Sending on LPF/ens33/00:0c:29:77:56:52/192

10 ubuntu dhcpd[1984]: Sending on Socket/fallback/fallback-net

10 ubuntu dhcpd[1984]: Server starting service

:12 ubuntu dhcpd[1984]: DHCPDISCOVER from 00:50:56:c0:00:08 via ens3

Hinh 2.12: Status isc-dhcp-server Cài đặt thành công DHCP service (Hình 2.12)

2.1.2 Cấp phát địa chỉ IP động cho Kali Linux - Client (PC2)

- Kiểm tra xem máy đã để cấu hình cổng NAT (VM/setting/network adapter)

- Bước 1: Cấu hình để cho máy nhận IP động

Trang 7

se Vao terminal, gõ lệnh: ifconfig, xem tên của card mạng là eth0 (Hình 2.13)

~

eth®: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

Hình 2.13: Xem tên của card mạng

e Gõ lệnh, Hình 2.14:

nano /etc/network/interfaces

se Khởi động lại máy để lấy cấu hình mới, dùng lệnh: reboot

¢ Vao terminal, gõ lệnh: ifconfig, sẽ thấy PC2 đã được cấp phát dia chi IP động thông qua DHCP server (PC1), Hình 2.16

eth®: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

inet 192.168.17.11 netmask 255.255.255.@ broadcast 192.168.17.255

inet6 fe80::20c:29ff:fea4:c470 prefixlen 64 scopeid @x20<Link> ether 00:0c:29:a4:c4:70 txqueuelen 1000 (Ethernet)

RX packets 23 bytes 1946 (1.9 KiB)

RX errors ® dropped @ overruns @ frame 0

TX packets 2@ bytes 3238 (3.1 KiB)

TX errors ® dropped @ overruns @ carrier @ collisions 0

Hình 2.16: PC2 có địa chỉ IP động thông qua DHCP server (PC1)

2.1.3 Cấp phát địa chỉ IP động cho Windows 10 - Client (PC3)

- Kiểm tra xem máy đã để cấu hình cổng NAT (VM/setting/network adapter)

- Bước 1: Cấu hình để cho máy nhận IP động

Trang 8

Vao Control Panel -> Network and Internet -> Network and Sharing Center -> chon Change adapter setting -> nhan chudt phai Local Area Connection -> chon Properties (Hinh 2.17)

x Ethernet0

` Unidentified network

G@ Intel(R) 82574L Gigabit Netw——~

@ Disable Status Diagnose

® Bridge Connections Create Shortcut

9 Delete

® Rename

9 Properties

Hinh 2.17: Change adapter setting

Vao Internet Protocol Version 4, Hinh 2.18:

4 Ethernet0 Properties x Networking

Connect using:

@ Intel(R) 82574L Gigabit Network Connection

This connection uses the following items:

| EB Cient for Microsoft Networks ^

M “ile and Printer Sharing for Microsoft Networks (0i aos Packet Scheduler

Vì ,ạ Du Protocol V

CX) „„ Microsoft Netwod‹ Adapter Muliplexor Protocol

VÌ » Microsoft LLDP Protocol Driver

OK Cancel Hinh 2.18: Local Area Connection Properties Chọn như Hình 2.19 :

Trang 9

for the appropriate IP settings

@ Obtain an IP address automatically Use the following IP address:

@ Obtain DNS server address automatically

©) Use the following DNS server addresses:

is Type the name of a program, folder, document, or Internet

= resource, and Windows will open it for you

Trang 10

Hinh 2.22: Xin cap lai dia chi IP Kết quả: thành công cấp phát địa chỉ IP động thông qua DHCP server (PC1) Dùng lệnh: ipconfig, để kiểm tra (Hình 2.23):

192.168.1

Hình 2.23: Thành công cấp phát địa chỉ IP động

2.1.4 Kết quả mong muốn

- Cài đặt và cấu hình thành công dịch vụ DHCP Server trên Ubuntu -

- Cấp phát địa chỉ IP động cho máy client thông qua dịch vụ DHCP Server

- Gõ lệnh: apt-get install bind9

- Gõ “Y” để tiếp tục cài đặt, chương trình sẽ tự động cài đặt

2.2.3 Đặt IP tĩnh

- Cấu hình như ảnh Chú ý là địa chỉ IP không được trùng với địa chỉ nào trong mạng (Kiểm tra bằng lệnh ping) (Hình 2.24)

root@ubuntu: ~ :~# ifconfig ens33 192.168.200.3 netmask 255.255.255.0 :~# route add default gw 192.168.200.1

Trang 11

Hinh 2.24: Cau hinh IP tinh

- Sử dụng lệnh ifconfig dé kiém tra xem da cap nhật IP chưa

- Để khởi động lại mạng gõ lệnh: /etc/init.d/networking restart

- Sử dụng lệnh ifconfig để kiểm tra lại IP

2.2.4 Cấu hình DNS ra mạng bằng địa chỉ Google

- Gõ lệnh: gedit /etc/bind/named.conf.options

- Bỏ // và thêm 2 địa chỉ 8.8.8.8 và 8.8.4.4 vào forwarders như hình (Hình 2.25)

options { directory "/var/cache/bind";

// If there is a firewall between you and nameservers you want // to talk to, you may need to fix the firewall to allow multiple // ports to talk See http://www.kb.cert.org/vuls/id/80e113 // If your ISP provided one or more IP addresses for stable // nameservers, you probably want to use them as forwarders

// Uncomment the following block, and insert the addresses replacing // the all-0's placeholder

forwarders {

8.8.8.8;

35 /

// If BIND logs error messages about the root key being expired, // you will need to update your keys See https://www.isc.org/bind-key

// Do any local configuration here

// Consider adding the 1918 zones here, if they are not used in your // organization

Trang 12

2.2.5.2 Tạo file cơ sở dữ liệu DNS

Copy và chỉnh sửa file

Hình 2.27: Chỉnh sửa file ptit.com.fw

- Tiếp theo: gedit /etc/bind/ptit.com.rv (Hình 2.28)

Hình 2.28: Chỉnh sửa file ptit.com.rv

- Kiểm tra lại xem tệp vùng hoạt động có chính xác không:

named-checkzone ptit.com /etc/bind/ptit.com.fw named-checkzone ptit.com /etc/bind/ptit.com.rv

2.2.6 Sửa tên miền trong thư viện động

- Thực hiện lệnh: gedit /etc/resolv.conf (Hình 2.29)

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

# DO NOT EDIT THIS FILE BY HAND YOUR CHANGES WILL BE OVERWRITTEN

#

nameserver 192.168.200.3

search ptit.com

Trang 13

Hinh 2.29: Sua tén mién

2.2.7 Kết quả mong muốn

- Restart dịch vụ: /etc/init.d/bind9 restart -

- Kiểm tra dịch vụ sử dụng lệnh nslookup (dùng lệnh exit để thoát) (Hình 2.30)

root@ubuntu: ~ :~# nslookup hn.ptit.com

Server: 192.168.209 3

Address: 192.168.200.3#53 Nane : hn.ptit.com

Address: 192.168.200.3

:~# nslookup 192.168.200.3

Server: 192.168.200 3

Address: 192.168.200.3#53 3.200.168.192.in-addr.arpa name = hn.ptit.com

t~#

Hình 2.30 2.3 Thực hành cài đặt và quản trị Apache Server

2.3.1 Các bước thực hiện

- Update: apt-get update

2.3.1.1 Cài đặt apache2

- Gõ lệnh: apt-get install apache2

- Gõ “Y” để tiếp tục cài đặt.(Hình 2.31)

:~# apt-get insta Reading package lists

Building dependency tree Reading state information

The following additional packages will be installed:

apache2-bin apache2-data apache2-utils libapri Libaprutil1 Libaprutili-dbd-sqlite3 Libaprutili-ldap liblua5.1-0 Suggested packages:

apache2-doc apache2-suexec-pristine | apache2-suexec-custom The following NEW packages will be installed:

apache2 apache2-bin apache2-data apache2-utils libapri libaprutil1

Ngày đăng: 15/02/2025, 22:16

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN