1. Home
  2. Docs
  3. 笔记Linux
  4. 网络服务
  5. 网卡

网卡

查看本机IP: ifconfig
查看80端口: netstat -tunlp | grep 80
IP地址设置: sudo gedit /etc/network/interfaces
Linux监听端口测试 nc -l 0.0.0.0 6066 更多
客户端扫描端口是否开放 nc -v host port 更多

#添加以下内容:
auto eth0                  #设置自动启动eth0接口
iface eth0 inet static     #配置静态IP
address 192.168.11.88      #IP地址
netmask 255.255.255.0      #子网掩码
gateway 192.168.11.1        #默认网关

===ubuntu22.04.1

文件更改的位置: /etc/netplan/ 该文件夹下面一般只有一个文件

sudo vim /etc/netplan/00-installer-config.yaml

# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s3:
      dhcp4: false
      dhcp6: false
      addresses:
        - 192.168.1.227/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses: [192.168.1.1,8.8.8.8]
  version: 2

重启网卡 sudo netplan apply
再次查看: ip address

virtualbox下ubuntu 22.04固定ip设置

Was this article helpful to you? Yes No

How can we help?