linux 認為ip是屬于主機的而不是接口的
ARP協定
響應:
路由類型:靜态 動态
主機路由 網路路由 預設路由
檢視網絡跑ip
ifconfig
ip addr show
ip addr show eth0
ip -s link show (s 統計)
ip addr add ip位址 添加ip位址
ip link eth0 down 禁用eth0 的ip位址
網絡裝置的配置:
speed 100 或1000 手動設定速率
ethool -i eth0
-s eth0 speed 100 指定設定裝置進行配置
duplex half 或 full 設定雙工模式
autoneg on 或off 開啟或關閉自動協商
dhcp 關閉時 會有一個自動專有位址:169.254 僅用來實作本地網絡的通信
網卡綁定多個ip設定:格式:ifcfg-ethx:y (x y為數字)
cp ifcfg-eth0 ifcfg-etho:0
vim ifcfg-eth0:0 編輯
網卡綁定大量ip 格式:ifcfg-ethx-rangex
vim ifcfg-eth0-range0 添加
IPADDR_START=10.1.1.1
IPADDR_END=10.1.1.20
NETMASK=255.0.0.0
路由資訊檢視: ip route
netstat -rn
route -n
靜态路由配置: route add -net ip/netmask gateway
route add -net 172.16.0.1/24 gt 172.16.0.2
route add -net host ip gateway ip
臨時生效
永久生效 /etc/sysconfig/network-scripts/
編輯 route-eth0 加入ip 即可
ADDRESS0=10.10.10.0
NETWORK0=255.0.0.0
GETEWAY0=172.16.0.25
ADDRESS1=10.10.10.0
NETWORK1=255.0.0.0
GETEWAY1=172.16.0.25
重新開機網絡 service network restart
網絡測試指令:
ping
traceroute
修改主機名:/etc/sysconfig/network 永久生效 /etc/hosts 也可
臨時的 hostname 主機名
systrl -w kernel.hostname=
dns 配置: /etc/resolv.conf
gethostip www.a.com 可以獲得ip
host -t A www.a.com 也可
dig -t instructor.example.com
/etc/sysconfig/network-scripts/ifcfg-eth0:
設定PERDNS=no 可以不讓覆寫DNS位址
netstat -t 檢視tcp連接配接 -u udp連接配接 -tln 檢視監聽
nmap 探測掃描工具 yum install nmap
-p 掃描端口的
-sL 主機清單 nmap -sL 192.168.0.1-25 -o
抓包工具:
tcpdump -i eth0
wireshark yum install wireshark
wireshark-gnome 圖形界面的
以太網通道綁定:網卡綁定 實作負載均衡和單點故障
modprobe bonding 加載綁定子產品
自動加載該子產品: 添加在etc/modprobe.conf
alias bond0 bonding