docker网络 之- linux /proc/sys/net/ipv4/ip_forward

网络类型介绍:https://blog.csdn.net/ithaibiantingsong/article/details/81386307?utm_source=app&app_version=4.5.2

查看网络:https://blog.csdn.net/weixin_43733154/article/details/110119533?utm_source=app&app_version=4.5.2

常用命令:ip转发深入研究文章 https://blog.csdn.net/li_101357/article/details/78415461

docker network ls  # 
brctl show 
cat /proc/sys/net/ipv4/ip_forward  # 默认是0 echo给上1 就可以转发

# 永久修改 参考文章:https://www.cnblogs.com/wangbaobao/p/6674464.html

echo "echo 1 > /proc/sys/net/ipv4/ip_forward" >> /etc/rc.d/rc.local \
&& echo 1 > /proc/sys/net/ipv4/ip_forward \
&& chmod +x /etc/rc.d/rc.local \
&& ll /etc/rc.d/rc.local \
&& cat /proc/sys/net/ipv4/ip_forward

 

 

# 网络查看脚本

#!/bin/bash
#
## Define variables
Result="./all_container_net_type.txt"

## Empty or new $Result file
>$Result

## For loop
All_stat_container_id=( $(docker container ls -aq) )
for((i=0;i<${#All_stat_container_id[*]};i++)) 
do
    # define variables
    Container_type_info=" $(docker container inspect ${All_stat_container_id[i]} | grep "NetworkMode"|grep -w "$Container_net_type" |sed 's# ##g') "
    
    # Save the result
    echo "${All_stat_container_id[i]}  $Container_type_info" >>$Result    
    
done

## Rusult info
echo "Result to \"$Result\" file"

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值