測試網絡
顯示主機名 hostname centos6 /etc/sysconfig/network 更改主機名 centos7使用 配置文件/etc/hostname hostnamectl status [root@localhost ~]# hostnamectl Static hostname: localhost.localdomain Icon name: computer-vm Chassis: vm Machine ID: c00fb0d822ce4e889fc914291bc4ec31 Boot ID: cb0856f215c54eed9b5a3ae3e30c37b2 Virtualization: vmware Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-327.el7.x86_64 Architecture: x86-64 hostnamectl set-hostname HOSTNAME 測試網絡連通性 ping ping x.x.x.x 80 可以測試端口是否打開,是否運行相應的服務。 mtr 顯示正確的路由表 ip route 確定名稱服務器使用: nslookup host dig 跟蹤路由 ?traceroute [root@yangyouwei ~]# traceroute 10.1.0.1 traceroute to 10.1.0.1 (10.1.0.1), 30 hops max, 60 byte packets 1 10.1.0.1 (10.1.0.1) 0.444 ms 0.752 ms 0.656 ms ?Tracepath [root@yangyouwei ~]# tracepath 10.1.0.1 1?: [LOCALHOST] pmtu 1500 1: 10.1.0.1 (10.1.0.1) 1.512ms reached 1: 10.1.0.1 (10.1.0.1) 1.213ms reached Resume: pmtu 1500 hops 1 back 1
網絡客戶端工具
lftp, ftp, lftpget, wget # lftp[-p port] [-u user[,password]] SERVER 子命令: get、mget、ls、help # lftpgetURL # ftp # wget wget[option]... [URL]... -q: 靜默模式 -c: 斷點續傳 -O: 保存位置 --limit-rates=: 指定傳輸速率
FTP
ftp:工具比較老了,推薦是用lftp,默認一般不安裝。
[root@yangyouwei ~]# ftp 10.1.0.1 Connected to 10.1.0.1 (10.1.0.1). 220 (vsFTPd 3.0.2) Name (10.1.0.1:root): ftp ##########輸入用戶名 ftp 或anonymous 匿名登陸 331 Please specify the password. Password: #####匿名登陸不使用密碼 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> pwd #########顯示處于ftp服務器的那個目錄下 257 "/" ##########ftp服務器的根下,不是服務器系統的根。 ftp> ls ##########顯示當前目錄下的內容 227 Entering Passive Mode (10,1,0,1,99,87). 150 Here comes the directory listing. drwxr-xr-x 23 0 0 4096 Jul 23 06:14 pub 226 Directory send OK. ftp> cd pub #############切換目錄 250 Directory successfully changed. 在命令提示符下!COMMAND可執行終端下的命令不用退出ftp ftp> !pwd /root ftp> help Commands may be abbreviated. Commands are: ! debug mdir sendport site $ dir mget put size account disconnect mkdir pwd status append exit mls quit struct ascii form mode quote system bell get modtime recv sunique binary glob mput reget tenex bye hash newer rstatus tick case help nmap rhelp trace cd idle nlist rename type cdup image ntrans reset user chmod lcd open restart umask close ls prompt rmdir verbose cr macdef passive runique ? delete mdelete proxy send
下載文件,文件默認下載到用戶本地主機的工作目錄下。
get FILENAME 注:文件名支持table鍵補全
passive(被動) 表示切換模式
主動模式:默認ftp服務器是主動模式 被動模式: 注:主動模式,是讓客戶端主動向服務器的指定端口提交請求,被動模式,客戶端等待服務器發起請求 ftp> passive Passive mode off. 主動模式服務器開啟20端口 ftp> passive Passive mode on.
切換本地目錄 ftp> lcd 效果等同于!cd
退出ftp
bye或quit
lftp
默認是匿名登陸,不需要輸入用戶名和密碼
[root@yangyouwei ~]# lftp 10.1.0.1 lftp 10.1.0.1:~> lftp 10.1.0.1:~> ls drwxr-xr-x 23 0 0 4096 Jul 23 06:14 pub ls 顯示文件時,文件和目錄帶顏色。 支持名稱補全。 支持命令歷史 下載文件 get FILENAME 默認下載到,用戶本地主機的當前工作目錄 mget FILENAME FILENAME... ###下載多個文件。 上傳文件 mput FILENAME ###上傳本地主機當前工作目錄下的文件,上傳到當前ftp目錄下。 lftp幫助 lftp 10.1.0.1:/> help !<shell-command> (commands) alias [<name> [<value>]] bookmark [SUBCMD] cache [SUBCMD] cat [-b] <files> cd <rdir> chmod [OPTS] mode file... close [-a] [re]cls [opts] [path/][pattern] debug [<level>|off] [-o <file>] du [options] <dirs> exit [<code>|bg] get [OPTS] <rfile> [-o <lfile>] glob [OPTS] <cmd> <args> help [<cmd>] history -w file|-r file|-c|-l [cnt] jobs [-v] kill all|<job_no> lcd <ldir> lftp [OPTS] <site> ls [<args>] mget [OPTS] <files> mirror [OPTS] [remote [local]] mkdir [-p] <dirs> module name [args] more <files> mput [OPTS] <files> mrm <files> mv <file1> <file2> [re]nlist [<args>] open [OPTS] <site> pget [OPTS] <rfile> [-o <lfile>] put [OPTS] <lfile> [-o <rfile>] pwd [-p] queue [OPTS] [<cmd>] quote <cmd> repeat [OPTS] [delay] [command] rm [-r] [-f] <files> rmdir [-f] <dirs> scache [<session_no>] set [OPT] [<var> [<val>]] site <site_cmd> source <file> torrent [-O <dir>] <file> user <user|URL> [<pass>] version wait [<jobno>] zcat <files> zmore <files>
非交互式ftp下載命令
lftpget
ftp和lftp都是交互式命令,不能寫在腳本中。腳本中使用,lftpget命令
lftpget url …
[root@yangyouwei ~]# lftpget ftp://10.1.0.1/pub/ISOs/MirantisOpenStack-5.1.iso ^C../MirantisOpenStack-5.1.iso' at 172890240 (6%) 58.67M/s eta:39s [Receiving d
wget
可以下載http資源和ftp資源。
支持多線程下載
-q 支持靜默
-c 支持斷點續傳
-o 支持保存位置
-o /PATH/TO/NEWNAME
[root@yangyouwei ~]# wget ftp://10.1.0.1/pub/ISOs/MirantisOpenStack-5.1.iso --2016-07-20 19:19:11-- ftp://10.1.0.1/pub/ISOs/MirantisOpenStack-5.1.iso => “MirantisOpenStack-5.1.iso.1” Connecting to 10.1.0.1:21... connected. Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD (1) /pub/ISOs ... done. ==> SIZE MirantisOpenStack-5.1.iso ... 2586220544 ==> PASV ... done. ==> RETR MirantisOpenStack-5.1.iso ... done. Length: 2586220544 (2.4G) (unauthoritative) 5% [======> ] 144,988,272 98.7M/s ^ 7% [========> ] 195,183,472 77.0M/s ^
瀏覽器
links
純字符界面瀏覽器
默認沒有安裝
[root@yangyouwei ~]# rpm -qf /usr/bin/links
elinks-0.12-0.21.pre5.el6_3.x86_64
[root@yangyouwei ~]# links 10.1.0.1
Home Page
內網服務
GitLab
Zabbix Server (UserName:Guest,Password:)
Yum Repository
Repo Conf Files
Fedora EPEL
Kickstart Files
FTP Server
http://10.1.0.1/ks_files/ [——]
使用ESC鍵調用菜單。
links –dump 純文字方式顯示,不含格式信息
[root@yangyouwei ~]# links –dump 10.1.0.1
內網服務
[1]GitLab
[2]Zabbix Server (UserName:Guest,Password:)
[3]Yum Repository
[4]Repo Conf Files
[5]Fedora EPEL
[6]Kickstart Files
[7]FTP Server
References
Visible links
-
ftp://10.1.0.1/pub/
links –source
看源代碼
curl
簡單,直接看源碼
[root@yangyouwei ~]# curl 10.1.0.1 <title>Home Page</title> <body> <h1>內網服務</h1> <h3><a href="http://10.1.0.1:8088/">GitLab</a></h3> <h3><a href="http://10.1.0.1/zabbix">Zabbix Server (UserName:Guest,Password:)</a></h3> <h3><a href="http://10.1.0.1/cobbler/ks_mirror">Yum Repository</a></h3> <h3><a href="http://10.1.0.1/repofiles/">Repo Conf Files</a></h3> <h3><a href="http://10.1.0.1/fedora-epel/">Fedora EPEL</a></h3> <h3><a href="http://10.1.0.1/ks_files/">Kickstart Files</a></h3> <h3><a href="ftp://10.1.0.1/pub/">FTP Server</a></h3> </body>
加上選項 -I 可以看服務器信息
[root@yangyouwei ~]# curl -I 10.1.0.1
HTTP/1.1 200 OK
Date: Wed, 07 Sep 2016 0330 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Last-Modified: Sat, 23 Jul 2016 0625 GMT
ETag: "20c-53847ac2446bf"
Accept-Ranges: bytes
Content-Length: 524
Content-Type: text/html; charset=UTF-8
telnet
可以測試端口是否開啟。
[root@localhost yum.repos.d]# telnet 10.1.0.1 999 Trying 10.1.0.1... telnet: connect to address 10.1.0.1: Connection refused [root@localhost yum.repos.d]# telnet 10.1.0.1 80 Trying 10.1.0.1... Connected to 10.1.0.1. Escape character is '^]'. ^C Connection closed by foreign host.
原創文章,作者:yyw,如若轉載,請注明出處:http://www.www58058.com/44960