amazon-web-services - Centos 配置上的路由

标签 amazon-web-services amazon-ec2 centos redhat

我需要设置路由规则。
这是我需要做的:

ip route add default via 172.31.32.1 dev eth1 tab 2
ip rule add from 172.31.38.228/32 tab 2
ip rule add to 172.31.38.228/32 tab 2

我正在使用 Centos 7。
此路线适用于 AWS。

我如何设置它,它会在重启后工作?

最佳答案

  • 创建可执行脚本文件“example.sh”
  • 输入命令crontab -e
  • 添加此行 @reboot /path/to/example.sh

  • example.sh 将在下面包含您的命令。就是这样,每次重新启动时,这些命令都会被执行。
    ip route add default via 172.31.32.1 dev eth1 tab 2
    ip rule add from 172.31.38.228/32 tab 2
    ip rule add to 172.31.38.228/32 tab 2
    

    关于amazon-web-services - Centos 配置上的路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37946680/

    相关文章:

    node.js - NodeJS 集群调度策略

    amazon-web-services - aws amplify 可以与 NextJS 配合使用吗?

    apache - 错误-suexec :notice

    amazon-web-services - 在 Lambda 中创建 AmazonS3Client 时出现 OutOfMemoryError

    bash - 在谷歌云上的 bash 中获取正确的 $HOME 目录

    shell - Cron xdotool 不运行

    node.js - AWS 重定向 URL,并在 Node.js 服务器中运行 AngularJS

    c# - 为什么打开 Couchbase 存储桶会非常慢?

    amazon-ec2 - 如何降级 AWS EC2?

    amazon-web-services - EC2 卷 : how do I set it so that it WILL delete on termination?