第6、7关企业真实考试题
@(Lunix 学习之路)[Linux, 运维, 企业考试题, 考试题]
试卷说明
我们不生产企业面试题,我们只是企业面试题的搬运工
原卷采用是图片的形式,在此为了排版美观工整,修改成文字版,并根据题型调整了题的顺序,但也保证是与真题一模一样。
考试说明
(共 30 道题,每题 3.3 分共 100 分,请尽量详细作答)
试卷说明
闭卷考察时禁止抄袭笔记抄袭他人,禁止任何搜索,!抄袭是可耻的!
[TOC]
简述题
1、查看当前系统每IP连接数
首先直接查看当前网络连接状态信息。
[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:*
####### 创建一个用户用ssh登录在看看
[root@www ~]#useradd lemon
[root@www ~]#passwd lemon
#######复制当前窗口并切换到新建的用户上操作
[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窗口操作,查看连接状态信息
[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的连接数
[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
将重复行从输出文件中删除-c
在行首加上本行在文件中出现的次数
[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、 请列出以下服务使用的端口
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下系统常用的几种文件系统格式,并比较各自特点
提示
:Linux下查看当前内核系统支持的文件系统:
一般都在 /lib/modules/kernl-version/kernel/fs/ 目录下包含了当前内核版本支持的文件系统:
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中常用的文件系统
ext3
:ext2的升级版,带日志功能
ext4
:EXT4是第四代扩展文件系统(英语:Fourth extended filesystem,缩写为 ext4)是Linux系统下的 日志文件系统,是ext3文件系统的后继版本。
xfs
: 由SGI开发的先进的日志文件系统,支持超大容量文件
4、在Linux下给INTEL.82571网卡的第一个口配置IP,网关和增加路由,请写出命令行的具体步骤
IP 10.10.10.10/255.255.255.0 网关 10.10.10.1 需要增加路由:到网段192.168.0.0/255.255.255.0 通过ip 10.10.10.2出去
ifconfig #查看网卡配置
ifconfig eth0 10.10.10.10/24 #在网卡eth0上配置ip
ifconfig
route add default gw 10.10.10.1 #添加网关
route -n #查看路由表
route add -net 192.168.0.0/24 gw 10.10.10.2 #添加网段和下一跳的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 **错误操作:将网关删除了,其实直接添加就好了**
route add gw 192.168.10.2 #添加不上了
route add -net fefaul gw 192.168.10.2 #添加不上了
route -n #这时检查路由表发现只有一条路由
route add default gw 192.168.10.2 #只能添加默认网关
route -n #有了默认网关了,路由表多了0.0.0.0
ping baidu.com #可以ping通百度了
5、以请求www.baidu.com 为例,请详细描述DNS解析过程.
Paste_Image.png[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
网友评论