同局域网电脑无法访问双网卡Ubuntu的swagger的解决

小编的一个成熟的swagger,部署在配置爽网卡的ubuntu上,同局域网的其他电脑无法访问swagger的接口。闭着眼睛瞎撞一通后,用如下的方法解决掉。

第一步:检查网络配置:ifconfig,得到如下信息
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.50.154  netmask 255.255.255.0  broadcast 192.168.50.255
        inet6 2408:8207:18e0:93b0:ae1f:6bff:feea:1e64  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::ae1f:6bff:feea:1e64  prefixlen 64  scopeid 0x20<link>
        ether ac:1f:6b:ea:1e:64  txqueuelen 1000  (以太网)
        RX packets 643  bytes 166311 (166.3 KB)
        RX errors 0  dropped 62  overruns 0  frame 0
        TX packets 357  bytes 62183 (62.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xa4600000-a467ffff  

eno2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether ac:1f:6b:ea:1e:65  txqueuelen 1000  (以太网)
        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
        device memory 0xa4500000-a457ffff  

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  (本地环回)
        RX packets 328  bytes 41029 (41.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 328  bytes 41029 (41.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

发现eno2信息有些鸡肋

第二步,闭眼执行 sudo ifconfig eno2 down

第三步,执行 ifconfig,确认网卡是否禁用

第四步,执行sudo ufw enable启动防火墙

此时,swagger访问正常
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值