2017-9-3 a solution to a series of problems with Linux NIC

Source: Internet
Author: User
Tags joins switches

What happened in these months is still quite a lot, for a new company, OpenStack Harvest or some, of course, this is to learn by themselves, but completely into an outsourced project feeling, I am a bit uncomfortable. If you do anything, you need documentation, then my creative mind is not erased? I believe in my ability to learn, so I must have consciousness, accumulated over the accumulation of thin hair. Alas, but I feel that I still have a bit of failure, life from time to time will be confused, I am never satisfied with life and technology, I know that my greatest advantage is young, I am less than 22 years old. Do not say nonsense, the following are my one months of work notes, easy to use later.

First, how to determine whether multiple network ports on the same network card?

View the physical adapter for each network port, if the Phyad is the same, on the same NIC, otherwise not.
[Email protected] ~]# Ethtool eth0|grep-i Phyad
phyad:0
[Email protected] ~]# Ethtool eth1|grep-i Phyad
Phyad:1

Second, the replacement drive does not restart the solution case

Reference Document: http://blog.csdn.net/zhengwei125/article/details/53928061
[[email protected]/]# echo "---" >/sys/class/scsi_host/host2/scan//Main command

1. After the disk is added, the view is not refreshed.

[Email protected]/]# fdisk-l
disk/dev/sda:17.2 GB, 17179869184 bytes

2. View the host bus number

[email protected]/]# ls/ sys/class/scsi_host/
Host0 host1 host2
3. Rescan the SCSI bus to add a device
[[email  protected]/]# echo "---" >/sys/class/scsi_host/host0/scan
[[email protected]/]# echo"---">/sys/class/scsi_host/host1/scan
[[email protected]/]# echo"---">/sys/class/scsi_host/host2/scan
4. View disk, you can see/dev/sdb   This is the new disk

[[email protected]/]# Fdisk-l
DISK/DEV/SDA: 21.5 GB, 21474836480 bytes, 41943040 sectors
units = sectors of 1 * = + bytes
sector size (logical/physical): bytes/512 bytes
i/o size (minimum/optimal): bytes/512 bytes


disk/dev/sdb:21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * MB = bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes

Third, configure the auxiliary IP for access to the external network, to solve the problem of single network card can not access the Internet, that is, a network card multiple IP addresses.

Note: If the virtual machine is the best choice for bridging mode

[Email protected] ~]# ifconfig eth0:0 172.16.17.138
[[Email protected] ~]# IP R # #查看路由
[[Email protected] ~]# IP r Delete default via 10.20.0.1 dev eth0 # #删除旧的默认网关
[[Email protected] ~]# IP r add default via 172.16.17.254 dev eth0 # #修改新网关
[Email protected] ~]# cat/etc/resolv.conf # #检查DNS

Four, solve the problem of Linux network card disorderly sequence

only eth0, eth2, no eth1, or NIC is eno16777736 case
Reference Document: Http://jingyan.baidu.com/article/6b97984db5f0971ca2b0bf25.html
1. Delete 70-persistent-net.rules files
[email protected] udev]# CD rules.d/
[[email protected] rules.d]# ls
60-raw.rules 70-persistent-cd.rules 70-persistent-net.rules 80-docker.rules 90-hal.rules
[email protected] rules.d]# rm-f 70-persistent-net.rules
uninstall NIC driver: Rmmod e1000 # #此步骤会导致远程中断, only log in to the console
Reload NIC driver: Modprobe e1000
Restart the network card services: Service network restart
Change configuration file: Ifcfg-eth1

Five, Huawei switch easy to configure the VLAN access and trunk mode

configuration of the PXE switch:
telnet 172.16.161.251
<PXE-Switch> System-view
[Pxe-switch] Display current-configuration
[Pxe-switch] Display VLAN 5
[Pxe-switch] interface Ethernet 1/0/11
[Pxe-switch] Port access VLAN 5
[Pxe-switch] quit
[Pxe-switch] Save

Configuration of the Gigabit switch:
Telnet 172.16.161.254
[Layer1-switch] Interface GIGABITETHERNET0/0/4
[Layer1-switch-gigabitethernet0/0/4]port Link-type Trunk
[Layer1-switch-gigabitethernet0/0/4]port trunk allow-pass VLAN 167 201 2010

Six, the network card binding bond 0 experimental notes, the different network card network port through the twisted pair to connect to the same switch

Reference Document: Http://www.cnblogs.com/hyp-19871112/p/5461615.html
Note: Bond 1, Bond 5, Bond 6 do not require a switch configuration in the process of bond making, even if the NIC does not participate in the binding work.

[[email protected] network-scripts]# cat ifcfg-bond0
device=bond0
Bootproto=none
onboot= Yes
ipaddr= 192.168.11.100
netmask= 255.255.255.0

[[email protected] network-scripts]# Cat ifcfg-eth1
device=eth1
bootproto=none
Span style= "font-family:"courier New", Courier; Font-size:16px ">master=bond0
slave=yes

[email protected] network-scripts]# cat Ifcfg-eth2
Device=eth2
Bootproto=none
Master=bond0
Slave=yes

[email protected] ~]# cat/etc/modprobe.d/bonding.conf
alias bond0 Bonding
options Bonding mode=0 miimon=200 # #mode是核心部分
[email protected] ~]# modprobe bonding
[email protected] ~]# Lsmod|grep bonding
Bonding 141566 0
[email protected] ~]# service network restart
[email protected] ~]# ifconfig

2:eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc Pfifo_fast State up Qlen 1000link/ether 00:0c:29:a0:24:81 brd ff:ff:ff:ff:ff:ffinet 192.168.11.136/24 BRD 192.168.11.255 Scope Globa L Dynamic eth0valid_lft 1770sec preferred_lft 1770sec3:eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> MTU 1500 Qdisc Pfifo_fast Master bond0 State up Qlen 1000link/ether 00:0c:29:a0:24:8b BRD ff:ff:ff:ff:ff:ff4:eth2: <broadcast,m Ulticast,slave,up,lower_up> MTU Qdisc pfifo_fast Master bond0 State up Qlen 1000link/ether 00:0c:29:a0:24:8b BRD F F:FF:FF:FF:FF:FF5:BOND0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> MTU Qdisc noqueue State up Qlen 1000link/ Ether 00:0c:29:a0:24:8b BRD ff:ff:ff:ff:ff:ffinet 192.168.11.100/24 BRD 192.168.11.255 scope Global Bond0 

[Email protected] ~]# cat/proc/net/bonding/bond0
Ethernet Channel Bonding driver:v3.7.1 (April 27, 2011)

Bonding mode:load Balancing (round-robin)

Switch Link aggregation configuration: a is the combination of switches and switches, two machines do the same configuration, if a port is 100M, then the two switches are 4 ports, that is, the rate of 400M packets. Here the switch and the dual NIC are also configured, should be the same effect.


# interface Eth-trunk # port Link-type trunk# Port trunk allow VLAN ten to 100# quit# interface g0/0/0/1# eth-trunk # DIS Play Trunkmembership Eth-trunk 1 Verify whether the creation was successful, if the port joins # display Eth-trunk 1 on another switch also configures Eth-trunk, joins the port.

Seven, can ping pass but SSH does not go up, this problem bored me to death, looks simple, but is the wrong row

In fact, the most critical issue with service iptables status becomes inactive, but service iptables stop is required

Q Question : 1, can ping the Linux node 192.168.11.133, but SSH does not go up? How to troubleshoot
Resolution: (1)" Shut down the Windows Firewall, you can communicate "Windows notebook can ping 192.168.11.133, but fuel ping does not pass windows."
(2)" Shut down the Linux firewall iptables, or SSH not up "# Systemctl stop iptables

Could not connect to ' 192.168.11.133 ' (port): Connection failed.
(3) "Check SSH configuration file, no problem ah, allow password login, restart SSH service" # systemctl restart sshd
(4) "Shut down the iptables and immediately restart the sshd" # Service Iptables stop
# Service Sshd Restart

problem : 2, Virtual machine NAT mode and Windows notebook does not pass?

unresolved: (1) VMNET8 is turned on normally, ifconfig eth0 can see the IP address and up status normally.
(2) # Systemctl status Firewalld is turned off and Windows Firewall is turned off.
(3) # Service network restart no avail
(4) # Iptables-f Empty the firewall is useless
(5) Check/etc/sysconfig/network-scripts configuration file is flawless.
(6) Try adding eth1 and change to bridge mode, add the same segment as the Windows notebook---> Discover windows can pass virtual machine, but virtual machine does not pass windows.
---> Then judge the firewall is not closed, guess is iptables still exist, # service iptables stop
(7) Back to the Windows can pass the virtual machine, but SSH does not pass the problem, look past the wrong note, useless, temporary to eth1 added IP is likely to occupy the phone, I ping just mobile phone IP. So the problem comes down to NAT mode and bridge mode, you can't ping the virtual machine
(8) eth0 change to static IP test.

2017-9-3 a solution to a series of problems with Linux NIC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.