Linux 第17天: (09月02日) 練習和做業vim
netstat -nt 查看網絡鏈接網絡
netstat -no 查看網絡鏈接winless
tasklist |findstr ??? 查看進程winide
echo 50 > /proc/sys/net/ipv4/ip_default_ttl 改ttl值
ping -f 10.1.250.95 -s 65507 icmp***spa
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all 不迴應ping
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts 不迴應廣播rest
arp 查看arp表
ip neigh 查看arp表dns
1 1
10 2
100 4
1000 8
10000 16
100000 32
1000000 64
10000000 128進程
bc
ibase=2
obase=10
2 輸入十進制數
10 算出二進制數ip
let i=2#1000
echo $i路由
/etc/udev/rules.d/70-persistent-net.rules 網卡更名
/etc/sysconfig/network-scripts/ifcfg-eth0 網卡配置,含設備名
BOOTPROTO=none 或 DHCP
IPADDR=x.x.x.x
PREFIX=16
GATEWAY=
DNS1=
DNS2=
DNS3=
HWADDR改成MACADDR
chkconfig --list NetworkManager
service NetworkManager status
service NetworkManager restart
service NetworkManager stop 臨時關閉
chkconfig NetworkManager off 永久關閉
systemctl status NetworkManager
systemctl stop NetworkManager
service network restart
ifconfig eth0 down 禁用網卡
ifconfig -a 查看全部網卡
route -n 查看路由
cat /etc/resolv.conf 查看dns
cp ifcfg-eth0 ifcfg-eth0:100 配置網卡別名,多個IP
bonding多個網卡一個IP實驗
vim ifcfg-bond0 bonding
DEVICE=bond0
IPADDR=x.x.x.x
PREFIX=16
GATEWAY=x.x.x.x
DNS1=
BONDING_OPTS="miimon=100 mode=1"
vim ifcfg-eth0
DEVICE=etho
SLAVE=yes
MASTER=bond0
cat /proc/net/bonding/bond0
PC--R1--R2--PC2 實驗
chkconfig NetworkManager off 永久關閉
service NetworkManager stop 臨時關閉
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
IPADDR=192.168.0.1
PREFIX=24
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
IPADDR=10.0.0.1
PREFIX=8
service network restart
route add -net 172.16.0.0/16 gw 10.0.0.2 dev eth1
echo 1 > /proc/sys/net/ipv4/ip_forward
iptable -F
chkconfig NetworkManager off 永久關閉
service NetworkManager stop 臨時關閉
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
IPADDR=172.16.0.1
PREFIX=16
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
IPADDR=10.0.0.2
PREFIX=8
service network restart
route add -net 192.168.0.0/24 gw 10.0.0.1 dev eth1
echo 1 > /proc/sys/net/ipv4/ip_forward
iptable -F
rpm -qa "kernel*"
yum -y install kernel-doc
cd /usr/share/doc/kernel-doc-2.6.32/Documentation/
cd networking
less bonding.txt
lsmod |grep binding
rmmod binding
ifconfig
ethtool -i eth0 查看網卡
dmesg |grep -i eth 查看網卡
lsmod |grep e1000
rmmod e1000 卸載網卡驅動
modprobe -r e1000 卸載網卡驅動
modprobe e1000 裝載網卡驅動
service network restart
locate e1000.ko 查找驅動文件
/lib/modules/2.6.32-573.el6.x86_64/kernel/drivers/net/e1000/e1000.ko
/lib/modules/2.6.32-642.el6.x86_64/kernel/drivers/net/e1000/e1000.ko
uname -r
rpm -e kernel-2.6.32-573.e16.x86_64
路由
yum -y install quagga
cd /etc/quagga
ls
cp ospf.conf.sample ospfd.conf
service ospfd start
vtysh 思科相似配置
netstat -tunpl
route -n
netstat -r 查看路由表
ifconfig -s 查看鏈接
netstat -i 查看鏈接
watch -n 1 netstat -i
ping -f x.x.x.x
ping -a xxxx 經過IP查電腦名
ip link 查看網卡
ifup eth1 啓用網卡
ifconfig eth1 up 啓用網卡
ifconfig 查看網卡
ip addr 查看網卡
ip addr flush dev eth1 清除IP
ip addr add
ip addr del
service network restart
systemctl restart network
cd /etc/sysconfig/network-scripts/
cp cp ifcfg-eth0 ifcfg-eth1
vim /etc/sysconfi/network-scripts/route-eth1 路由配置文件192.168.0.0/24 via 172.16.0.2或者ADDRESS1=192.168.0.0NETMASK1=255.255.255.0GATEWAY1=172.16.0.2## route add -net 192.168.0.0/24 gw 172.16.0.2 dev/eth1