-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from buty4649/README.md
Update README and add Japanese version
- Loading branch information
Showing
3 changed files
with
191 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,95 @@ | ||
[English](README.md) | [Japanese](README_ja.md) | ||
|
||
--- | ||
|
||
# netnsplan | ||
Easily automate Linux netns networks and configurations via YAML | ||
|
||
`netnsplan` is a tool for easily setting up and managing complex network environments using Linux's network namespaces (netns). Network configurations are defined using YAML files, and the `netnsplan` command is used to apply and manage these configurations. | ||
|
||
## Key Features | ||
|
||
- **Configuration via YAML**: Network settings are defined in a YAML file, enabling high readability and manageability. The configuration file is similar to netplan, allowing for easy network configuration. | ||
- **Network Namespace Management**: Supports the creation, configuration, and deletion of multiple network namespaces. | ||
- **Flexible Network Configuration**: Supports configuration of physical devices, dummy interfaces (dummy devices), and Veth devices, as well as address assignment and routing settings. | ||
- **Execution of Arbitrary Scripts**: Allows for the execution of any script on the network namespace after applying network settings. | ||
|
||
## Usage | ||
|
||
### Preparing the Configuration File | ||
|
||
Network settings are defined in a YAML file. Here is an example: | ||
|
||
```yaml | ||
netns: | ||
ns1: | ||
ethernets: | ||
eth0: | ||
addresses: | ||
- 10.1.0.1/24 | ||
dummy-devices: | ||
dummy0: | ||
addresses: | ||
- 10.2.0.1/24 | ||
veth-devices: | ||
veth0: | ||
addresses: | ||
- 10.3.0.1/24 | ||
peer: | ||
name: veth1 | ||
netns: ns2 | ||
addresses: | ||
- 10.3.0.2/24 | ||
``` | ||
In this configuration, two network namespaces, `ns1` and `ns2`, are created, each with different network interfaces configured. | ||
|
||
### Executing Commands | ||
|
||
To apply network namespaces and network settings based on the configuration file, execute the following command: | ||
|
||
```bash | ||
netnsplan apply -c config.yaml | ||
``` | ||
|
||
### Deleting Network Namespaces | ||
|
||
To delete the created network namespaces, execute the following command: | ||
|
||
```bash | ||
netnsplan destroy -c config.yaml | ||
``` | ||
|
||
## Installation | ||
|
||
### deb package | ||
|
||
```sh | ||
VERSION=$(wget -q -O- https://api.github.com/repos/buty4649/netnsplan/releases/latest | grep tag_name | cut -d '"' -f 4 | tr -d v) | ||
case $(uname -m) in x86_64) ARCH=amd64;; aarch64) ARCH=arm64;; esac | ||
wget https://github.com/buty4649/netnsplan/releases/download/v${VERSION}/netnsplan_${VERSION}_linux_${ARCH}.deb | ||
sudo apt install ./netnsplan_${VERSION}_linux_${ARCH}.deb | ||
``` | ||
|
||
### rpm package | ||
|
||
```sh | ||
VERSION=$(wget -q -O- https://api.github.com/repos/buty4649/netnsplan/releases/latest | grep tag_name | cut -d '"' -f 4 | tr -d v) | ||
case $(uname -m) in x86_64) ARCH=amd64;; aarch64) ARCH=arm64;; esac | ||
yum install https://github.com/buty4649/netnsplan/releases/download/v${VERSION}/netnsplan_${VERSION}_linux_${ARCH}.rpm | ||
``` | ||
|
||
### Pre-built binary | ||
|
||
```sh | ||
VERSION=$(wget -q -O- https://api.github.com/repos/buty4649/netnsplan/releases/latest | grep tag_name | cut -d '"' -f 4 | tr -d v) | ||
case $(uname -m) in x86_64) ARCH=amd64;; aarch64) ARCH=arm64;; esac | ||
wget https://github.com/buty4649/netnsplan/releases/download/v${VERSION}/netnsplan_${VERSION}_linux_${ARCH}.tar.gz | ||
tar xvf netnsplan_${VERSION}_linux_${ARCH}.tar.gz netnsplan | ||
chmod +x netnsplan | ||
sudo chown root: netnsplan | ||
sudo mv netnsplan /usr/local/sbin/netnsplan | ||
``` | ||
|
||
## License | ||
|
||
See [LICENSE](LICENSE) © [buty4649](https://github.com/buty4649/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
[English](README.md) | [日本語(Japanese)](README_ja.md) | ||
|
||
--- | ||
|
||
# netnsplan | ||
|
||
`netnsplan`は、Linuxのネットワーク名前空間(netns)を利用して複雑なネットワーク環境を簡単にセットアップ・管理するためのツールです。YAMLファイルを用いてネットワーク設定を定義し、`netnsplan`コマンドを通じてこれらの設定を適用・管理します。 | ||
|
||
## 主な特徴 | ||
|
||
- **YAMLによる設定**: ネットワークの設定をYAMLファイルで定義し、可読性の高い設定管理を実現します。netplanに似たコンフィグファイルで、簡単にネットワーク設定ができます。 | ||
- **ネットワーク名前空間の管理**: 複数のネットワーク名前空間の作成、設定、削除をサポートします。 | ||
- **柔軟なネットワーク設定**: 物理デバイス、ダミーデバイス(dummy)、vethデバイスの設定や、アドレス割り当て、ルーティング設定など、多様なネットワーク設定に対応します。 | ||
- **任意のスクリプトの実行**: ネットワーク設定適用後に任意のスクリプトをネットワーク名前空間上で実行できます。 | ||
|
||
## 使用方法 | ||
|
||
### 設定ファイルの準備 | ||
|
||
ネットワーク設定はYAMLファイルによって定義します。以下はその例です: | ||
|
||
```yaml | ||
netns: | ||
ns1: | ||
ethernets: | ||
eth0: | ||
addresses: | ||
- 10.1.0.1/24 | ||
dummy-devices: | ||
dummy0: | ||
addresses: | ||
- 10.2.0.1/24 | ||
veth-devices: | ||
veth0: | ||
addresses: | ||
- 10.3.0.1/24 | ||
peer: | ||
name: veth1 | ||
netns: ns2 | ||
addresses: | ||
- 10.3.0.2/24 | ||
``` | ||
この設定では、`ns1`と`ns2`という二つのネットワーク名前空間を作成し、それぞれに異なるネットワークインターフェイスを設定しています。 | ||
|
||
### コマンドの実行 | ||
|
||
設定ファイルを元にネットワーク名前空間とネットワーク設定を適用するには、以下のコマンドを実行します: | ||
|
||
```bash | ||
netnsplan apply -c config.yaml | ||
``` | ||
|
||
### ネットワーク名前空間の削除 | ||
|
||
作成したネットワーク名前空間を削除するには、以下のコマンドを実行します: | ||
|
||
```bash | ||
netnsplan destroy -c config.yaml | ||
``` | ||
|
||
## インストール | ||
|
||
### debパッケージ | ||
|
||
```sh | ||
VERSION=$(wget -q -O- https://api.github.com/repos/buty4649/netnsplan/releases/latest | grep tag_name | cut -d '"' -f 4 | tr -d v) | ||
case $(uname -i) in x86_64) ARCH=amd64;; aarch64) ARCH=arm64;; esac | ||
wget https://github.com/buty4649/netnsplan/releases/download/v${VERSION}/netnsplan_${VERSION}_linux_${ARCH}.deb | ||
sudo apt install ./netnsplan_${VERSION}_linux_${ARCH}.deb | ||
``` | ||
|
||
### rpmパッケージ | ||
|
||
```sh | ||
VERSION=$(wget -q -O- https://api.github.com/repos/buty4649/netnsplan/releases/latest | grep tag_name | cut -d '"' -f 4 | tr -d v) | ||
case $(uname -i) in x86_64) ARCH=amd64;; aarch64) ARCH=arm64;; esac | ||
yum install https://github.com/buty4649/netnsplan/releases/download/v${VERSION}/netnsplan_${VERSION}_linux_${ARCH}.rpm | ||
``` | ||
|
||
### ビルド済みバイナリ | ||
|
||
```sh | ||
VERSION=$(wget -q -O- https://api.github.com/repos/buty4649/netnsplan/releases/latest | grep tag_name | cut -d '"' -f 4 | tr -d v) | ||
case $(uname -i) in x86_64) ARCH=amd64;; aarch64) ARCH=arm64;; esac | ||
wget https://github.com/buty4649/netnsplan/releases/download/v${VERSION}/netnsplan_${VERSION}_linux_${ARCH}.tar.gz | ||
tar xvf netnsplan_${VERSION}_linux_${ARCH}.tar.gz netnsplan | ||
chmod +x netnsplan | ||
sudo chown root: netnsplan | ||
sudo mv netnsplan /usr/local/sbin/netnsplan | ||
``` | ||
|
||
## ライセンス | ||
|
||
See [LICENSE](LICENSE) © [buty4649](https://github.com/buty4649/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters