Git Product home page Git Product logo

nfg's Introduction

一个简单的基于nftables的端口转发工具

使用方法:

  1. 安装nftables

    apt install -y nftables // Debian/Ubuntu
    yum install -y nftables // CentOS
    
  2. 打开IPv4转发

    echo -e "net.ipv4.ip_forward=1" >> /etc/sysctl.conf && sysctl -p
    

    可能需要重启生效

  3. 新建一个配置文件nfg.yml

    rules:
      - srcPort: 8081 #源端口
        dstAddr: 2.2.2.2 #目标地址
        dstPort: 8082 #目标端口
        protocol: both #可选 tcp udp both
      - srcAddr: 3.3.3.3 #源地址,如果不知道填什么就把这一项删了,程序自动获取
        srcPort: 8081-8089 #支持端口段
        dstAddr: 4.4.4.4
        dstPort: 8081-8089
        protocol: tcp
  4. 执行./nfg -w -s nfg.yml,监听配置文件的变化实时更新NAT规则,同时每隔一分钟会更新域名所对应的IP 也可执行./nfg -g -s nfg.yml,生成转发规则并输出到终端

nfg's People

Contributors

kzw200015 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.