第6、7關(guān)企業(yè)真實考試題
@(Lunix 學(xué)習(xí)之路)[Linux, 運維, 企業(yè)考試題, 考試題]
試卷說明
我們不生產(chǎn)企業(yè)面試題您炉,我們只是企業(yè)面試題的搬運工
原卷采用是圖片的形式原在,在此為了排版美觀工整友扰,修改成文字版,并根據(jù)題型調(diào)整了題的順序晤斩,但也保證是與真題一模一樣焕檬。
考試說明
(共 30 道題姆坚,每題 3.3 分共 100 分澳泵,請盡量詳細作答)
試卷說明
閉卷考察時禁止抄襲筆記抄襲他人,禁止任何搜索兼呵,兔辅!抄襲是可恥的!
[TOC]
簡述題
1击喂、查看當前系統(tǒng)每IP連接數(shù)
首先直接查看當前網(wǎng)絡(luò)連接狀態(tài)信息维苔。
[root@www ~]# netstat -an
####### -a 顯示所有的套接字 -n 直接使用ip地址而不解析名稱
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 52 192.168.10.128:22 192.168.10.1:4586 ESTABLISHED
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:25 :::* LISTEN
udp 0 0 0.0.0.0:68 0.0.0.0:*
####### 創(chuàng)建一個用戶用ssh登錄在看看
[root@www ~]#useradd lemon
[root@www ~]#passwd lemon
#######復(fù)制當前窗口并切換到新建的用戶上操作
[oldboy@www ~]$ su - lemon
密碼:
[lemon@www ~]$ ssh 192.168.10.128
The authenticity of host '192.168.10.128 (192.168.10.128)' can't be established.
RSA key fingerprint is 4f:eb:33:f7:86:2b:d1:4f:ab:f5:b1:ca:ba:3a:ac:89.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.128' (RSA) to the list of known hosts.
lemon@192.168.10.128's password: #輸入當前用戶密碼。
[lemon@www ~]$
#######再切換到root窗口操作懂昂,查看連接狀態(tài)信息
[root@www ~]# netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 52 192.168.10.128:22 192.168.10.1:4586 ESTABLISHED
tcp 0 0 192.168.10.128:22 192.168.10.128:55412 ESTABLISHED
tcp 0 0 192.168.10.128:55412 192.168.10.128:22 ESTABLISHED
tcp 0 0 192.168.10.128:22 192.168.10.1:9089 ESTABLISHED
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:25 :::* LISTEN
udp 0 0 0.0.0.0:68 0.0.0.0:*
#######計算當前IP的連接數(shù)
[root@www ~]# netstat -an|grep "ESTABLISHED" #過濾出當前連接使用的IP
tcp 0 52 192.168.10.128:22 192.168.10.1:4586 ESTABLISHD
tcp 0 0 192.168.10.128:22 192.168.10.128:55412 ESTABLISHD
tcp 0 0 192.168.10.128:55412 192.168.10.128:22 ESTABLISHD
tcp 0 0 192.168.10.128:22 192.168.10.1:9089 ESTABLISHD
[root@www ~]# netstat -an|grep "ESTABLISHE" |awk '{print$4}' #過濾出IP
192.168.10.128:22
192.168.10.128:22
192.168.10.128:55412
192.168.10.128:22
[root@www ~]# netstat -an|grep "ESTABLISHE" |awk '{print$4}'|awk -F: '{print $1}'
192.168.10.128
192.168.10.128
192.168.10.128
192.168.10.128
uniq
將重復(fù)行從輸出文件中刪除-c
在行首加上本行在文件中出現(xiàn)的次數(shù)
[root@www ~]# netstat -an|grep "ESTABLISHE" |awk '{print$4}'|awk -F: '{print $1}'|un
iq -c
4 192.168.10.128
[root@www ~]# netstat -an|grep "ESTABLISHE" |awk '{print$4}'|awk -F: '{print $1}'|uniq -c|sort -n
4 192.168.10.128
[root@www ~]#
2介时、 請列出以下服務(wù)使用的端口
http、https、ftp沸柔、telnet循衰、ssh、rsync褐澎、dns会钝、mysql
方法一:
[root@www ~]# awk --posix '$1~/^(http|https|ftp|telnet|ssh|rsync|dns|mysql)$/{print$0}' /etc/services
ftp 21/tcp
ftp 21/udp fsp fspd
ssh 22/tcp # The Secure Shell (SSH) Protocol
ssh 22/udp # The Secure Shell (SSH) Protocol
telnet 23/tcp
telnet 23/udp
http 80/tcp www www-http # WorldWideWeb HTTP
http 80/udp www www-http # HyperText Transfer Protocol
http 80/sctp # HyperText Transfer Protocol
https 443/tcp # http protocol over TLS/SSL
https 443/udp # http protocol over TLS/SSL
https 443/sctp # http protocol over TLS/SSL
rsync 873/tcp # rsync
rsync 873/udp # rsync
mysql 3306/tcp # MySQL
mysql 3306/udp # MySQL
ftp 21/sctp # FTP
ssh 22/sctp # SSH
方法二:
[root@www ~]# grep --color -Ew "^(http|https|ftp|telnet|ssh|rsync|dns|mysql)" /etc/services
ftp-data 20/tcp
ftp-data 20/udp
ftp 21/tcp
ftp 21/udp fsp fspd
ssh 22/tcp # The Secure Shell (SSH) Protocol
ssh 22/udp # The Secure Shell (SSH) Protocol
telnet 23/tcp
telnet 23/udp
http 80/tcp www www-http # WorldWideWeb HTTP
http 80/udp www www-http # HyperText Transfer Protocol
http 80/sctp # HyperText Transfer Protocol
https 443/tcp # http protocol over TLS/SSL
https 443/udp # http protocol over TLS/SSL
https 443/sctp # http protocol over TLS/SSL
rsync 873/tcp # rsync
rsync 873/udp # rsync
mysql 3306/tcp # MySQL
mysql 3306/udp # MySQL
ftp-data 20/sctp # FTP
ftp 21/sctp # FTP
ssh 22/sctp # SSH
http-mgmt 280/tcp # http-mgmt
http-mgmt 280/udp # http-mgmt
ftp-agent 574/tcp # FTP Software Agent System
ftp-agent 574/udp # FTP Software Agent System
http-rpc-epmap 593/tcp # HTTP RPC Ep Map
http-rpc-epmap 593/udp # HTTP RPC Ep Map
mysql-cluster 1186/tcp # MySQL Cluster Manager
mysql-cluster 1186/udp # MySQL Cluster Manager
mysql-cm-agent 1862/tcp # MySQL Cluster Manager Agent
mysql-cm-agent 1862/udp # MySQL Cluster Manager Agent
mysql-im 2273/tcp # MySQL Instance Manager
mysql-im 2273/udp # MySQL Instance Manager
dns-llq 5352/tcp # DNS Long-Lived Queries
dns-llq 5352/udp # DNS Long-Lived Queries
mysql-proxy 6446/tcp # MySQL Proxy
mysql-proxy 6446/udp # MySQL Proxy
http-wmap 8990/tcp # webmail HTTP service
http-wmap 8990/udp # webmail HTTP service
https-wmap 8991/tcp # webmail HTTPS service
https-wmap 8991/udp # webmail HTTPS service
ssh-mgmt 17235/tcp # SSH Tectia Manager
ssh-mgmt 17235/udp # SSH Tectia Manager
3 、請列出Linux下系統(tǒng)常用的幾種文件系統(tǒng)格式工三,并比較各自特點
提示
:Linux下查看當前內(nèi)核系統(tǒng)支持的文件系統(tǒng):
一般都在 /lib/modules/kernl-version/kernel/fs/ 目錄下包含了當前內(nèi)核版本支持的文件系統(tǒng):
ls /lib/modules/kernl-version/kernel/fs/
[root@www ~]# ls /lib/modules/2.6.32-642.el6.x86_64/kernel/fs/
autofs4 cifs dlm ext2 fat gfs2 jffs2 nfs nls udf
btrfs configfs ecryptfs ext3 fscache jbd lockd nfs_common squashfs xfs
cachefiles cramfs exportfs ext4 fuse jbd2 mbcache.ko nfsd ubifs
ext2
:早期linux中常用的文件系統(tǒng)
ext3
:ext2的升級版迁酸,帶日志功能
ext4
:EXT4是第四代擴展文件系統(tǒng)(英語:Fourth extended filesystem,縮寫為 ext4)是Linux系統(tǒng)下的 日志文件系統(tǒng)俭正,是ext3文件系統(tǒng)的后繼版本奸鬓。
xfs
: 由SGI開發(fā)的先進的日志文件系統(tǒng),支持超大容量文件
4掸读、在Linux下給INTEL.82571網(wǎng)卡的第一個口配置IP全蝶,網(wǎng)關(guān)和增加路由,請寫出命令行的具體步驟
IP 10.10.10.10/255.255.255.0 網(wǎng)關(guān) 10.10.10.1 需要增加路由:到網(wǎng)段192.168.0.0/255.255.255.0 通過ip 10.10.10.2出去
ifconfig #查看網(wǎng)卡配置
ifconfig eth0 10.10.10.10/24 #在網(wǎng)卡eth0上配置ip
ifconfig
route add default gw 10.10.10.1 #添加網(wǎng)關(guān)
route -n #查看路由表
route add -net 192.168.0.0/24 gw 10.10.10.2 #添加網(wǎng)段和下一跳的ip
route -n
route del -net 192.168.0.0/24 gw 10.10.10.2 #刪除路由配置
route -n
ifconfig
ifconfig eth0 192.168.10.128 #將ip修改成原來的
ifconfig
route del gw 10.10.10.1 **錯誤操作:將網(wǎng)關(guān)刪除了寺枉,其實直接添加就好了**
route add gw 192.168.10.2 #添加不上了
route add -net fefaul gw 192.168.10.2 #添加不上了
route -n #這時檢查路由表發(fā)現(xiàn)只有一條路由
route add default gw 192.168.10.2 #只能添加默認網(wǎng)關(guān)
route -n #有了默認網(wǎng)關(guān)了抑淫,路由表多了0.0.0.0
ping baidu.com #可以ping通百度了
5、以請求www.baidu.com 為例,請詳細描述DNS解析過程.
[root@www data]# dig @223.5.5.5 www.baidu.com +trace
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> @223.5.5.5 www.baidu.com +trace
; (1 server found)
;; global options: +cmd
. 120828 IN NS a.root-servers.net.
. 120828 IN NS h.root-servers.net.
. 120828 IN NS k.root-servers.net.
. 120828 IN NS i.root-servers.net.
. 120828 IN NS l.root-servers.net.
. 120828 IN NS j.root-servers.net.
. 120828 IN NS b.root-servers.net.
. 120828 IN NS e.root-servers.net.
. 120828 IN NS d.root-servers.net.
. 120828 IN NS c.root-servers.net.
. 120828 IN NS f.root-servers.net.
. 120828 IN NS m.root-servers.net.
. 120828 IN NS g.root-servers.net.
;; Received 228 bytes from 223.5.5.5#53(223.5.5.5) in 238 ms
com. 172800 IN NS e.gtld-servers.net.
com. 172800 IN NS h.gtld-servers.net.
com. 172800 IN NS k.gtld-servers.net.
com. 172800 IN NS d.gtld-servers.net.
com. 172800 IN NS l.gtld-servers.net.
com. 172800 IN NS i.gtld-servers.net.
com. 172800 IN NS g.gtld-servers.net.
com. 172800 IN NS j.gtld-servers.net.
com. 172800 IN NS c.gtld-servers.net.
com. 172800 IN NS m.gtld-servers.net.
com. 172800 IN NS b.gtld-servers.net.
com. 172800 IN NS f.gtld-servers.net.
com. 172800 IN NS a.gtld-servers.net.
;; Received 491 bytes from 192.112.36.4#53(192.112.36.4) in 328 ms
baidu.com. 172800 IN NS dns.baidu.com.
baidu.com. 172800 IN NS ns2.baidu.com.
baidu.com. 172800 IN NS ns3.baidu.com.
baidu.com. 172800 IN NS ns4.baidu.com.
baidu.com. 172800 IN NS ns7.baidu.com.
;; Received 201 bytes from 192.41.162.30#53(192.41.162.30) in 350 ms
www.baidu.com. 1200 IN CNAME www.a.shifen.com.
a.shifen.com. 1200 IN NS ns3.a.shifen.com.
a.shifen.com. 1200 IN NS ns1.a.shifen.com.
a.shifen.com. 1200 IN NS ns2.a.shifen.com.
a.shifen.com. 1200 IN NS ns5.a.shifen.com.
a.shifen.com. 1200 IN NS ns4.a.shifen.com.
;; Received 228 bytes from 220.181.38.10#53(220.181.38.10) in 121 ms
[root@www data]# dig @223.5.5.5 www.baidu.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> @223.5.5.5 www.baidu.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65394
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 29 IN CNAME www.a.shifen.com.
www.a.shifen.com. 29 IN A 61.135.169.125
www.a.shifen.com. 29 IN A 61.135.169.121
;; Query time: 37 msec
;; SERVER: 223.5.5.5#53(223.5.5.5)
;; WHEN: Tue Aug 23 15:14:18 2016
;; MSG SIZE rcvd: 90