linux网络管理

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

1.ifconfig
功能用于查看和配置网络接口的地址和参数,包括 IP 地址、网络掩码、广播地址
格式
ifconfig 有两种使用格式,分别用于查看和更改网络接口。
1ifconfig [选项] [网络接口]:用来查看当前系统的网络配置情况。
2ifconfig 网络接口 [选项] 地址:用来配置指定接口(如 eth0、eth1)的 IP 地址、网络掩码、广播地址等。
常见参数。
ifconfig 第二种格式的常见选项参数
-interface   指定的网络接口名,如 eth0 和 eth1   
up           激活指定的网络接口卡
down         关闭指定的网络接口
broadcast address   设置接口的广播地址
address             设置指定接口设备的 IP 地址  
netmask address     设置接口的子网掩码
实例
查看eth0的信息
[root@localhost other]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:22:15:0A:82:20 
          inet addr:10.0.6.5  Bcast:10.0.255.255  Mask:255.255.0.0
          inet6 addr: fe80::222:15ff:fe0a:8220/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:393564 errors:0 dropped:0 overruns:0 frame:0
          TX packets:134079 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:217643085 (207.5 MiB)  TX bytes:15786724 (15.0 MiB)
          Interrupt:18 Base address:0x2000
关闭eth0:
[root@localhost ~]# ifconfig eth0 down
[root@localhost ~]# ifconfig
lo       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:16436 Metric:1
          RX packets:1931 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1931 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2517080 (2.4 MiB) TX bytes:2517080 (2.4 MiB)

2.ifdown -interface = ifconfig -interface down

3.ifup -interface = ifconfig -interface up

4.nslookup       
功能查询一台机器的IP地址和其对应的域名
用法nslookup [IP 地址/域名]
实例
[root@localhost other]# nslookup
Server:         159.226.39.1
Address:        159.226.39.1#53

Non-authoritative answer:
Name:  
Address: 203.208.37.104
Name:  
Address: 203.208.37.99

5.ping   
功能用于查看网络上的主机是否在工作
用法ping [选项] 主机名/IP 地址
实例
[root@localhost other]# ping
PING (203.208.37.104) 56(84) bytes of data.
64 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq=1 ttl=240 time=8.12 ms
64 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq=2 ttl=241 time=7.52 ms
64 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq=3 ttl=241 time=10.3 ms

--- ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2024ms
rtt min/avg/max/mdev = 7.521/8.659/10.330/1.207 ms

6.netstat
功能显示网络连接、路由表和网络接口信息
用法netstat [-an]

7.ssh
功能利用 ssh 登录对方主机
用法ssh [选项] [IP 地址]
实例
利用ssh登录10.0.0.5的机器
#ssh 10.0.0.5
password:

8.telnet
功能 利用 telnet 协议访问主机
用法telent [选项] [IP 地址/域名]

9.ftp
功能利用 ftp 协议上传和下载文件
常见命令
account[password]       提供登录远程系统成功后访问系统资源所需的补充口令
ascii                   使用 ASCII 类型传输方式,为缺省传输模式
bin/ type binary        使用二进制文件传输方式(嵌入式开发中的常见方式)
bye                     退出 ftp 会话过程
cd remote-dir           进入远程主机目录
cdup                    进入远程主机目录的父目录
chmod mode file-name    将远程主机文件 file-name 的存取方式设置为 mode
close                   中断与远程服务器的 ftp 会话(与 open 对应)
delete remote-file      删除远程主机文件
debug[debug-value]      设置调试方式, 显示发送至远程主机的每条命令
dir/ls[remote-dir][local-file]  显示远程主机目录,并将结果存入本地文件 local-file
get remote-file[local-file]     将远程主机的文件 remote-file 传至本地硬盘的 local-file
lcd[dir]                        将本地工作目录切换至 dir
mdelete[remote-file]            删除远程主机文件
mget remote-files               传输多个远程文件
mkdir dir-name                  在远程主机中建立一个目录
mput local-file                 将多个文件传输至远程主机
open host[port]                 建立与指定 ftp 服务器的连接,可指定连接端口
passive                         进入被动传输方式(在这种模式下,数据连接是由客户程序发起的)
put local-file[remote-file]     将本地文件 local-file 传送至远程主机
system                          显示远程主机的操作系统类型
实例
[root@localhost ~]# ftp 127.0.0.1
Connected to 127.0.0.1 (127.0.0.1).
220 (vsFTPd 2.0.5)
Name (127.0.0.1:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> system
215 UNIX Type: L8
ftp> ls
227 Entering Passive Mode (127,0,0,1,150,166).
150 Here comes the directory listing.
-rwxrwxrwx    1 0        0        89370839 Jan 14  2010 The.Big.Bang.Theory.S03E12.mp4
drwxr-xr-x    2 0        0            4096 Jan 15  2010 pub
226 Directory send OK.
ftp> bye
221 Goodbye.

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: linux

“linux网络管理” 的相关文章