VirtualBox 7.0下配置两块网卡,即可以上网,又可以ssh

配置两块网卡,即可以上网,又可以ssh

配置一块网卡,选择【网络地址转换(NAT)】,设置使用DHCP获取IP地址。
配置一块网卡,选择【仅主机(Host-Only)网络】,手动配置IP地址。

IP Address:10.0.2.15
Default Route:10.0.2.2
DNS:8.8.8.8 114.114.114.114 223.5.5.5

[root@vm1 network-scripts]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::b3ed:43d8:17df:d3e8  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:39:0f:32  txqueuelen 1000  (Ethernet)
        RX packets 736  bytes 554046 (541.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 600  bytes 76308 (74.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.137.108  netmask 255.255.255.0  broadcast 192.168.137.255
        inet6 fe80::a00:27ff:fed1:13bc  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:d1:13:bc  txqueuelen 1000  (Ethernet)
        RX packets 814  bytes 76804 (75.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 619  bytes 89839 (87.7 KiB)
        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 196  bytes 15544 (15.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 196  bytes 15544 (15.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:39:03:d3  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.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

[root@vm1 network-scripts]# 

[root@vm1 network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:39:0f:32 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s3
       valid_lft 85984sec preferred_lft 85984sec
    inet6 fe80::b3ed:43d8:17df:d3e8/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:d1:13:bc brd ff:ff:ff:ff:ff:ff
    inet 192.168.137.108/24 brd 192.168.137.255 scope global noprefixroute dynamic enp0s8
       valid_lft 419sec preferred_lft 419sec
    inet 192.168.137.101/24 brd 192.168.137.255 scope global secondary enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fed1:13bc/64 scope link 
       valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:39:03:d3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:39:03:d3 brd ff:ff:ff:ff:ff:ff
[root@vm1 network-scripts]# 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值