ubuntu网卡设置

2023-11-07

UBUNTU网卡配置

主机名修改
hostnamectl set-hostname ubuntu1804
cat /etc/hostname
网卡改名

#修改配置文件为下面形式
vi /etc/default/grub
GRUB_CMDLINE_LINUX="net.ifnames=0"
#生效新的grub.cfg文件
grub-mkconfig -o /boot/grub/grub.cfg 
#或者
update-grub
#重启生效
reboot

修改名称后需要修改配置文件否则没有地址(一般两个缩进)

cat /etc/netplan/01-netcfg.yaml #自动获取
network:
   version: 2
   renderer: networkd
   ethernets:
       eth0:
         dhcp4: yes

 修改后执行
 netplan apply命令生效

添加网卡后 配置静态地址

yuml格式尽量用空格缩进


[root@ubuntu1804||15|netplan]#cd /etc/netplan/
[root@ubuntu1804||16|netplan]#ls
01-netcfg.yaml

[root@ubuntu1804||17|netplan]#cp 01-netcfg.yaml 02-netcfg.yaml
[root@ubuntu1804||18|netplan]#vim 02-netcfg.yaml 

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 renderer: networkd
 ethernets:
   eth1:
     dhcp4: no   #自动获取
     addresses: [192.168.8.10/24,10.0.0.10/8] #两个地址
     gateway4: 10.0.0.3   #网关
     nameservers:
       search: [magedu.com, magedu.org]  #自动补全
       addresses: [180.76.76.76, 8.8.8.8, 1.1.1.1]   #DNS
                       百度 
netplan apply   #重启网络服务    

查看ip和gateway
root@ubuntu1804:~#ip addr
root@ubuntu1804:~#route -n

查看DNS
root@ubuntu1804:~#ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Dec 12 11:36 /etc/resolv.conf ->
…/run/systemd/resolve/stub-resolv.conf
root@ubuntu1804:~#systemd-resolve --status #观察DNS信息

配置多卡静态IP #可以用一个文件代替多个

 # This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 renderer: networkd
 ethernets:
   eth0:
     dhcp4: no
     dhcp6: no
     addresses: [10.0.0.18/16]
     gateway4: 10.0.0.2       网关
     nameservers:
       addresses: [223.6.6.6]       DNS
   eth1:
     dhcp4: no
     dhcp6: no
     addresses: [10.20.0.18/16]
     routes:                            #配置路由
        - to: 10.30.0.0/16               #到达哪个网段
         via: 10.20.0.1                #网关(指向)
        - to: 10.40.0.0/16              
         via: 10.20.0.1
        - to: 10.50.0.0/16
         via: 10.20.0.1
        - to: 10.60.0.0/16
         via: 10.20.0.1


netplan aply 生效
route -n 查看

单网卡桥接

3 4 网卡桥接
[root@ubuntu1804||34|netplan]#cat /etc/netplan/01-netcfg.yaml
 # This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 renderer: networkd
 ethernets:
   eth1:
     dhcp4: no
     dhcp6: no
    eth2:
     dhcp4: no
   bridges:       #单独列出
    br0:          #设备名
     dhcp4: no
     dhcp6: no
     addresses: [10.0.0.18/16]
     gateway4: 10.0.0.1
     nameservers:
       addresses: [223.6.6.6]
     interfaces:
        - eth1             #要桥接的网卡
        - eth2              


netplan apply     #生效
brctl show        
ifconfig br0

四块网卡桥接

两个桥接

network:
 version: 2
 renderer: networkd
 ethernets:
   eth1:
     dhcp4: no
     dhcp6: no
    eth2:
     dhcp4: no
      eth3:
     dhcp4: no
     dhcp6: no
    eth4:
     dhcp4: no


   bridges:
    br0:
     dhcp4: no
     dhcp6: no
     addresses: [10.0.0.18/16]
     gateway4: 10.0.0.1
     nameservers:
       addresses: [223.6.6.6]
     interfaces:
        - eth1             #要桥接的网卡
        - eth2      


         br1:
     dhcp4: no
     dhcp6: no
     addresses: [10.0.0.18/16]
     gateway4: 10.0.0.1
     nameservers:
       addresses: [223.6.6.6]
     interfaces:
        - eth3            #要桥接的网卡
        - eth4            

brctl stp br1 off #生成树协议
ifconfig br1 down
brctl delbr br1  #删除

多网卡绑定


network:
 version: 2
 renderer: networkd
 ethernets:
   eth0:
     dhcp4: no
     dhcp6: no
   eth1:
     dhcp4: no
     dhcp6: no
 bonds:
   bond0:
     interfaces:
        - eth3
        - eth4
     addresses: [172.160.18/16]
     gateway4: 172.16.0.1
     nameservers:
       addresses: [223.6.6.6,223.5.5.5]
     parameters:
       mode: active-backup
       mii-monitor-interval: 100


ifconfig br0 down  关闭
brctl delbr br1   删除
brctl show

cat /proc/net/bonding/bond0 查看活跃的网卡

 [root@ubuntu1804||34|netplan]#cat /proc/net/bonding/bond0

双卡绑定加桥接

root@ubuntu1804:~# cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
  eth0:
    dhcp4: no
    dhcp6: no
  eth1:
    dhcp4: no
    dhcp6: no
bonds:
  bond0:
    interfaces:
       - eth0
       - eth1
    parameters:
      mode: active-backup
      mii-monitor-interval: 100
bridges:
  br0:
    dhcp4: no
    dhcp6: no
    addresses: [10.0.0.18/16]
    gateway4: 10.0.0.1
    nameservers:
      addresses: [223.6.6.6,223.5.5.5]
    interfaces:
      - bond0
root@ubuntu1804:~# netplan apply 
root@ubuntu1804:~# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.96dbd15c1daf no bond0
root@ubuntu1804:~# ifconfig br0
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
      inet 10.0.0.18 netmask 255.255.0.0 broadcast 10.0.255.255
      inet6 fe80::94db:d1ff:fe5c:1daf prefixlen 64 scopeid 0x20<link>
      ether 96:db:d1:5c:1d:af txqueuelen 1000 (Ethernet)
      RX packets 97 bytes 6634 (6.6 KB)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 83 bytes 8286 (8.2 KB)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@ubuntu1804:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref   Use Iface
0.0.0.0         10.0.0.1        0.0.0.0         UG    0      0        0 br0
10.0.0.0        0.0.0.0         255.255.0.0     U     0      0        0 br0
root@ubuntu1804:~# ifconfig
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
      ether 2a:20:b7:a8:58:37 txqueuelen 1000 (Ethernet)
      RX packets 2592 bytes 230049 (230.0 KB)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 2826 bytes 318282 (318.2 KB)
      TX errors 0 dropped 1 overruns 0 carrier 0 collisions 0
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
      inet 10.0.0.18 netmask 255.255.0.0 broadcast 10.0.255.255
      inet6 fe80::94db:d1ff:fe5c:1daf prefixlen 64 scopeid 0x20<link>
      ether 96:db:d1:5c:1d:af txqueuelen 1000 (Ethernet)
      RX packets 144 bytes 9890 (9.8 KB)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 117 bytes 12554 (12.5 KB)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
      ether 2a:20:b7:a8:58:37 txqueuelen 1000 (Ethernet)
      RX packets 27 bytes 1990 (1.9 KB)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 0 bytes 0 (0.0 B)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
      ether 2a:20:b7:a8:58:37 txqueuelen 1000 (Ethernet)
      RX packets 2565 bytes 228059 (228.0 KB)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 2826 bytes 318282 (318.2 KB)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
      inet 127.0.0.1 netmask 255.0.0.0
      inet6 ::1 prefixlen 128 scopeid 0x10<host>
      loop txqueuelen 1000 (Local Loopback)
      RX packets 1131 bytes 75592 (75.5 KB)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 1131 bytes 75592 (75.5 KB)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

网卡的多组绑定

可以实现网卡的多组绑定,比如:eth0,eth1绑定至bond0,eth2和eth3绑定bond1

root@ubuntu1804:~#cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
  eth0:
    dhcp4: no
    dhcp6: no
  eth1:
    dhcp4: no
    dhcp6: no
  eth2:
    dhcp4: no
    dhcp6: no
  eth3:
    dhcp4: no
    dhcp6: no
bonds:
  bond0:
    interfaces:
       - eth0
       - eth1
    addresses: [10.0.0.18/16]
    gateway4: 10.0.0.1
    nameservers:
      addresses: [223.6.6.6,223.5.5.5]
    parameters:
      mode: active-backup
      mii-monitor-interval: 100
  bond1:
    interfaces:
       - eth2
       - eth3
    addresses: [10.10.0.18/16]
    parameters:
      mode: active-backup
      mii-monitor-interval: 100
    routes:
       - to: 10.20.0.0/16
        via: 10.10.0.1
       - to: 10.30.0.0/16
        via: 10.10.0.1
       - to: 10.40.0.0/16
        via: 10.10.0.1
       - to: 10.50.0.0/16
        via: 10.10.0.1
root@ubuntu1804:~# netplan apply 
root@ubuntu1804:~# ifconfig 
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
      inet 10.0.0.18 netmask 255.255.0.0 broadcast 10.0.255.255
      inet6 fe80::2820:b7ff:fea8:5837 prefixlen 64 scopeid 0x20<link>
      ether 2a:20:b7:a8:58:37 txqueuelen 1000 (Ethernet)
      RX packets 273 bytes 23591 (23.5 KB)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 364 bytes 42455 (42.4 KB)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
bond1: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
      inet 10.10.0.18 netmask 255.255.0.0 broadcast 10.10.255.255
      inet6 fe80::c035:83ff:fea1:abbb prefixlen 64 scopeid 0x20<link>
      ether c2:35:83:a1:ab:bb txqueuelen 1000 (Ethernet)
      RX packets 8 bytes 480 (480.0 B)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 10 bytes 796 (796.0 B)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
      ether 2a:20:b7:a8:58:37 txqueuelen 1000 (Ethernet)
      RX packets 4 bytes 240 (240.0 B)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 0 bytes 0 (0.0 B)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
      ether 2a:20:b7:a8:58:37 txqueuelen 1000 (Ethernet)
      RX packets 269 bytes 23351 (23.3 KB)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 364 bytes 42455 (42.4 KB)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
      ether c2:35:83:a1:ab:bb txqueuelen 1000 (Ethernet)
      RX packets 4 bytes 240 (240.0 B)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 0 bytes 0 (0.0 B)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
      ether c2:35:83:a1:ab:bb txqueuelen 1000 (Ethernet)
      RX packets 4 bytes 240 (240.0 B)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 10 bytes 796 (796.0 B)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
      inet 127.0.0.1 netmask 255.0.0.0
      inet6 ::1 prefixlen 128 scopeid 0x10<host>
      loop txqueuelen 1000 (Local Loopback)
      RX packets 120 bytes 8344 (8.3 KB)
      RX errors 0 dropped 0 overruns 0 frame 0
      TX packets 120 bytes 8344 (8.3 KB)
      TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@ubuntu1804:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref   Use Iface
0.0.0.0         10.0.0.1        0.0.0.0         UG    0      0        0 bond0
10.0.0.0        0.0.0.0         255.255.0.0     U     0      0        0 bond0
10.10.0.0       0.0.0.0         255.255.0.0     U     0      0        0 bond1
10.20.0.0       10.10.0.1       255.255.0.0     UG    0      0        0 bond1
10.30.0.0       10.10.0.1       255.255.0.0     UG    0      0        0 bond1
10.40.0.0       10.10.0.1       255.255.0.0     UG    0      0        0 bond1
10.50.0.0       10.10.0.1       255.255.0.0     UG    0      0        0 bond1
root@ubuntu1804:~# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:34:df:9b
Slave queue ID: 0
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:34:df:91
Slave queue ID: 0
root@ubuntu1804:~# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth3
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth3
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:34:df:b9
Slave queue ID: 0
Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:34:df:a5
Slave queue ID: 0

网卡多组绑定+多组桥接

oot@ubuntu1804:~# cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 renderer: networkd
 ethernets:
   eth0:
     dhcp4: no
     dhcp6: no
   eth1:
     dhcp4: no
     dhcp6: no
   eth2:
     dhcp4: no
     dhcp6: no
   eth3:
     dhcp4: no
     dhcp6: no
 bonds:
   bond0:
     interfaces:
        - eth0
        - eth1
     parameters:
       mode: active-backup
       mii-monitor-interval: 100
   bond1:
     interfaces:
        - eth2
        - eth3
     parameters:
       mode: active-backup
       mii-monitor-interval: 100
 bridges:
   br0:
     dhcp4: no
     dhcp6: no
     addresses: [10.0.0.18/16]
     gateway4: 10.0.0.1
     nameservers:
       addresses: [223.6.6.6,223.5.5.5]
     interfaces:
        - bond0
   br1:
     dhcp4: no
     dhcp6: no
     interfaces:
        - bond1
     addresses: [10.10.0.18/16]
     routes:
        - to: 10.20.0.0/16
         via: 10.10.0.1
        - to: 10.30.0.0/16
         via: 10.10.0.1
        - to: 10.40.0.0/16
         via: 10.10.0.1
        - to: 10.50.0.0/16
         via: 10.10.0.1
root@ubuntu1804:~# netplan apply         
root@ubuntu1804:~# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.96dbd15c1daf no bond0
br1 8000.9e02ab0faeb0 no bond1
root@ubuntu1804:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref   Use Iface
0.0.0.0         10.0.0.1        0.0.0.0         UG    0      0        0 br0
10.0.0.0        0.0.0.0         255.255.0.0     U     0      0        0 br0
10.10.0.0       0.0.0.0         255.255.0.0     U     0      0        0 br1
10.20.0.0       10.10.0.1       255.255.0.0     UG    0      0        0 br1
10.30.0.0       10.10.0.1       255.255.0.0     UG    0      0        0 br1
10.40.0.0       10.10.0.1       255.255.0.0     UG    0      0        0 br1
10.50.0.0       10.10.0.1       255.255.0.0     UG    0      0        0 br1
root@ubuntu1804:~# ifconfig 
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
       ether 2a:20:b7:a8:58:37 txqueuelen 1000 (Ethernet)
       RX packets 1749 bytes 154597 (154.5 KB)
       RX errors 0 dropped 0 overruns 0 frame 0
       TX packets 1951 bytes 224182 (224.1 KB)
       TX errors 0 dropped 2 overruns 0 carrier 0 collisions 0
bond1: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
       ether c2:35:83:a1:ab:bb txqueuelen 1000 (Ethernet)
       RX packets 441 bytes 43111 (43.1 KB)
       RX errors 0 dropped 0 overruns 0 frame 0
       TX packets 21 bytes 1642 (1.6 KB)
       TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
       inet 10.0.0.18 netmask 255.255.0.0 broadcast 10.0.255.255
       inet6 fe80::94db:d1ff:fe5c:1daf prefixlen 64 scopeid 0x20<link>
       ether 96:db:d1:5c:1d:af txqueuelen 1000 (Ethernet)
       RX packets 164 bytes 11692 (11.6 KB)
       RX errors 0 dropped 0 overruns 0 frame 0
       TX packets 148 bytes 16165 (16.1 KB)
       TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
br1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
       inet 10.10.0.18 netmask 255.255.0.0 broadcast 10.10.255.255
       inet6 fe80::9c02:abff:fe0f:aeb0 prefixlen 64 scopeid 0x20<link>
       ether 9e:02:ab:0f:ae:b0 txqueuelen 1000 (Ethernet)
       RX packets 13 bytes 788 (788.0 B)
       RX errors 0 dropped 0 overruns 0 frame 0
       TX packets 9 bytes 726 (726.0 B)
       TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
       ether 2a:20:b7:a8:58:37 txqueuelen 1000 (Ethernet)
       RX packets 24 bytes 1906 (1.9 KB)
       RX errors 0 dropped 0 overruns 0 frame 0
       TX packets 0 bytes 0 (0.0 B)
       TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
       ether 2a:20:b7:a8:58:37 txqueuelen 1000 (Ethernet)
       RX packets 1725 bytes 152691 (152.6 KB)
       RX errors 0 dropped 0 overruns 0 frame 0
       TX packets 1951 bytes 224182 (224.1 KB)
       TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
       ether c2:35:83:a1:ab:bb txqueuelen 1000 (Ethernet)
       RX packets 24 bytes 1906 (1.9 KB)
       RX errors 0 dropped 0 overruns 0 frame 0
       TX packets 0 bytes 0 (0.0 B)
       TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth3: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
       ether c2:35:83:a1:ab:bb txqueuelen 1000 (Ethernet)
       RX packets 417 bytes 41205 (41.2 KB)
       RX errors 0 dropped 0 overruns 0 frame 0
       TX packets 21 bytes 1642 (1.6 KB)
       TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
       inet 127.0.0.1 netmask 255.0.0.0
       inet6 ::1 prefixlen 128 scopeid 0x10<host>
       loop txqueuelen 1000 (Local Loopback)
       RX packets 793 bytes 53888 (53.8 KB)
       RX errors 0 dropped 0 overruns 0 frame 0
       TX packets 793 bytes 53888 (53.8 KB)
       TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@ubuntu1804:~# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth3
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth3
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:34:df:b9
Slave queue ID: 0
Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 00:0c:29:34:df:a5
Slave queue ID: 0
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ubuntu网卡设置 的相关文章

  • 如何在 Linux 中重新添加 unicode 字节顺序标记?

    我有一个相当大的 SQL 文件 它以 FFFE 的字节顺序标记开头 我使用 unicode 感知的 linux 分割工具将此文件分割成 100 000 行块 但是当将这些传递回窗口时 它确实not与第一个部分以外的任何部分一样 只是它具有
  • Python将文件从Linux复制到WIndows

    我正在构建一个网站 该网站有一个表单 可以捕获用户数据并在用户数据上运行一些cgi cgi 的第一步是需要将文件从 Linux Web 服务器复制到 Windows 计算机 服务器将使用 Active Directory 角色帐户作为复制凭
  • 裸机交叉编译器输入

    裸机交叉编译器的输入限制是什么 比如它不编译带有指针或 malloc 的程序 或者任何需要比底层硬件更多的东西 以及如何才能找到这些限制 我还想问 我为目标 mips 构建了一个交叉编译器 我需要使用这个交叉编译器创建一个 mips 可执行
  • 在 Linux 控制台中返回一行?

    我知道我可以返回该行并用以下内容覆盖其内容 r 现在我怎样才能进入上一行来改变它呢 或者有没有办法打印到控制台窗口中的特定光标位置 我的目标是使用 PHP 创建一些自刷新的多行控制台应用程序 Use ANSI 转义码 http en wik
  • 可以作为命令行参数传递多少数据?

    在 Linux 下生成进程时可以发送多少字节作为命令行参数 gahooa 推荐了一篇好文章http www in ulm de mascheck various argmax http www in ulm de mascheck vari
  • 完整的 C++ i18n gettext()“hello world”示例

    我正在寻找完整的 i18ngettext 你好世界的例子 我已经开始了一个基于的脚本使用 GNU gettext 的本机语言支持教程 https web archive org web 20130330233819 http oriya s
  • 运行 shell 命令并将输出发送到文件?

    我需要能够通过 php 脚本修改我的 openvpn 身份验证文件 我已将我的 http 用户设置为免通 sudoer 因为这台机器仅在我的家庭网络中可用 我目前有以下命令 echo shell exec sudo echo usernam
  • 如何在特定的Java版本上运行应用程序?

    如何运行具有特定 Java 版本的应用程序 我安装了三个 Java 版本 myuser mysystem sudo update alternatives config java There are 3 choices for the al
  • 用于时间线数据的类似 gnuplot 的程序

    我正在寻找一个类似 gnuplot用于在时间轴中绘制数据图表的程序 类似 gnuplot 在 Linux 上运行 命令行功能 GUI 对我帮助不大 可编写脚本的语法 输出为 jpg png svg 或 gif 输出应该是这样的 set5 s
  • pthread_self() 返回的线程 ID 与调用 gettid(2) 返回的内核线程 ID 不同

    这句话来自于pthread self 的手册页 http linux die net man 3 pthread self 那么 我应该根据什么来决定是否应该使用pthread self or gettid确定哪个线程正在运行该函数 两者都
  • 如何从程序内部获取指向程序的特定可执行文件部分的指针? (也许是诽谤)

    我在 Linux 环境中 需要编写一个程序来检索放置在其可执行文件的某个部分中的一些数据 那么 如何从程序内部获取指向程序某个部分 通过其名称 的指针呢 我知道可以使用elf getdata 将节的索引作为参数传递给 get 和Elf Da
  • 隐式声明“gets”

    据我所知 隐式声明 通常意味着该函数必须在调用之前放置在程序的顶部 或者我需要声明原型 然而 gets应该在stdio h文件 我已包含 有没有什么办法解决这一问题 include
  • C++ Linux GCC 应用程序中的 GUID

    我有很多服务器运行这个 Linux 应用程序 我希望他们能够生成一个碰撞概率较低的 GUID 我确信我可以从 dev urandom 中提取 128 个字节 这可能没问题 但是有没有一种简单易用的方法来生成与 Win32 更等效的 GUID
  • 如何将命令输出作为多个参数传递给另一个命令

    我想将命令的每个输出作为多个参数传递给第二个命令 例如 grep pattern input returns file1 file2 file3 我想复制这些输出 例如 cp file1 file1 bac cp file2 file2 b
  • 安装 JDK 时出错:keytool 命令需要已安装的 proc fs (/proc)。 Linux 的 Windows 子系统

    我尝试在 Linux 的 Windows 子系统 Ubuntu 14 04 上安装 Oracle JDK 1 7 但出现以下错误 the keytool command requires a mounted proc fs proc Jav
  • grep 彩色线条

    我编写了一个简单的 PHP shell 脚本 它解析文件并输出某些元素 它产生大量的输出 采用不同的 bash 颜色 绿色表示正常 黄色表示警告 红色表示错误等 在开发过程中我想过滤掉一些行 例如 所有包含红色文本的行 我可以使用grep
  • 我可以在 Ubuntu 上使用 Homebrew 吗?

    我只是尝试使用 Homebrew 和 Linuxbrew 在我的 Ubuntu 服务器上安装软件包 但都失败了 这就是我尝试安装它们的方法 sudo apt get install build essential curl git m4 r
  • 在 MacOS 上构建需要 net461 的 dotnet SDK 项目的最简单方法

    我有一个 dotnet SDK sln and a build proj with
  • 点击界面没有出现

    我决定添加一个点击界面并在我的代码中使用它 但我能够得到它的状态 sudo ip f link tuntap add tap10 mode tap sudo ip link set tap10 up 之后当我执行 ip link 时 tap
  • 虚拟内存澄清——大连续内存的分配

    我有一个应用程序 我必须在 Windows 上分配 使用运算符 new 相当大的内存空间 数百 MB 该应用程序是 32 位 我们现在不使用 64 位 即使在 64 位系统上也是如此 我启用了 LARGEADDRESSAWARE 链接器选项

随机推荐

  • Mysql-DDL(数据定义语言)

    show databases 查看所有数据库 create databse 数据库名 创建数据库 use database 数据库名 使用数据库 删除表格如果存在 drop table if exists mumber1 create TA
  • Angular快速上手--创建Hero类

    0 前言 真实的英雄当然不止一个名字 在 src app 文件夹中为 Hero 类创建一个文件 并添加 id 和 name 属性 1 操作 src app app component ts复制并修改内容 export class Hero
  • ensp设计校园网,期末作业,课程设计报告

    1 实现功能 基本实现如下网络核心功能 1 三层架构设计 本课题按照三层网络结构 接入层 汇聚层 核心层 进行设计和规划 接入层要求提供较多的网络入口 汇聚层实现对接入层网络的互联 核心层完成校园内部和外部数据的交换 并实现路由和安全功能
  • 怎么查看vue源码

    有很多同学和我一样使用一段时间 vue 框架后 对它的源码就有了兴趣 但是不知道在哪里找 vue js 源码 随意创建一个vue项目 或者已有项目 找到根路径平级的 node modules 文件夹 往下拉 拉多一下 在文件夹尾巴一截的地方
  • SpringBoot笔记

    目录 开发准备 导出 常用注解 导出excel到指定位置 导出excel到指定web 导入 将指定位置Excel导入并显示至web 使用ExcelWriter基于模板导出 开发准备 1 导入依赖
  • Bar函数--Matplotlib

    函数Bar 用于绘制柱状图 使用bar绘制柱状图的过程中涉及到中文字体的显示问题 使用动态参数配置方法 指定了中文黑体 import matplotlib as mpl mpl rcParams font sans serif SimHei
  • web端播放m3u8视频流注意事项

    项目上有一个播放实时视频 直播 的需求 后端童鞋直接传过来一个类似 https live m3u8的视频流地址 让我自行播放 拿到地址的我一脸懵逼 下面开始我的探索 baidu 之路 HLS HTTP Live Streaming 介绍 m
  • Meta发布「分割一切」AI 模型,CV或迎来GPT-3时刻

    demo地址 Segment Anything Meta AI Meta 表示 这是第一个致力于图像分割的基础模型 自此 CV 也走上了 做一个统一某个 某些 全部 任务的全能模型 的道路 在此之前 分割作为计算机视觉的核心任务 已经得到广
  • java属性值注解

    查询条件开始时间 DateTimeFormat pattern yyyy MM dd HH mm ss JsonFormat pattern yyyy MM dd HH mm ss timezone GMT 8 private Date t
  • C# VS2010 Winform 查找链表的近邻值

    实现在类似数组中查找最接近目标值的数值 定义链表 定义链表 private List
  • 架构师进阶之路

    选择的范围太广 可以读的书太多 往往容易无所适从 我想就我自己读过的技术书籍中挑选出来一些 按照学习的先后顺序 推荐给大家 特别是那些想不断提高自己技术水平的Java程序员们 一 Java编程入门类 对于没有Java编程经验的程序员要入门
  • 随机森林建模

    在看datacastle的建模大赛 用r写了随机森林的二分类 上次代码用py跑的 这里想用交叉验证 但是跑了一天一夜也木有出来 还是把代码先保留下来吧 希望看到的人指正 rm list ls setwd D competitions dat
  • Android获取本地相册中图片视频

    权限
  • Linux多进程:exit——进程退出函数

    子进程结束释放自己的用户区数据 内核区数据由其父进程回收释放 pcb fd 等 进程退出函数 void exit int status status 是进程退出时的一个状态信息 父进程在回收子进程资源时可以获取 include
  • 求Sn=1!+2!+3!+4!+5!+…+n!之值,其中n是一个数字(n不超过20)。

    这个是一个比较坑的题 但也是一个极其能查缺补漏的题 题目描述 求Sn 1 2 3 4 5 n 之值 其中n是一个数字 n不超过20 输入 n 输出 Sn的值 样例输入 5 样例输出 153 在这里插入代码片 乍一看很简单 一下就打好了 但开
  • C++ 结构体转json

    FdogSerialize FdogSerialize是一个用于C 序列化的开源库 采用非入侵方式 无需在原有结构体上进行修改 目前支持基础类型 基础类型数组 结构体 以及vector list map等数据类型的序列化 支持JSON和XM
  • SHA-256算法实现

    SHA 256 算法输入报文的最大长度不超过2 64 bit 输入按512 bit 分组进行处理 产生 的输出是一个256 bit 的报文摘要 该算法处理包括以下几步 STEP1 附加填充比特 对报文进行填充使报文长度与448 模512 同
  • JSR303校验的全局错误处理

    实现一个全局处理类 并对异常进行判断处理 方法有如下几种 1 实现HandlerExceptionResolver接口 实现其中的resolveException 方法 public class GlobalExceptionResolve
  • 自上而下的企业级数据分析应用 更好地满足业务部门需求

    2016年5月26日 由亦策软件和Qlik原厂联合主办的 汽车行业大数据沙龙 在上海巴黎春天新世界酒店召开 与会嘉宾踏着小雨纷至而来 一起围绕着汽车行业目前数据分析的瓶颈 企业发展的局限 以及对未来的构想建设等话题展开了精彩的分享和热切的探
  • ubuntu网卡设置

    UBUNTU网卡配置 主机名修改 hostnamectl set hostname ubuntu1804 cat etc hostname 网卡改名 修改配置文件为下面形式 vi etc default grub GRUB CMDLINE