Snowpack
Tutorial for multi-route configuration
Snowpack currently also supports user-defined configuration for multiple paths, on which, user can:
- Define multiple routes where their data traversed through.
- Define the characteristics of the data traversing in each route (i.e transport protocol, destination port and ip).
Usage
To enable this function, user needs to execute Snowpack with the following arguments:
./snowpack-cli user -mr <config_file_path>
with config_file_path is the path to configuration file. An explanation of detail format of configuration file can be found in the following section.
The configuration file is in JSON format. If no version number is provided in the file, it is considered to be in v0 format
Noted that configurations introduced in later versions cannot be parsed with older version numbers and will be ignored.
Only version 0 and 1.0 are currently supported.
An example of the config file v0 can be found below.
{
"ROUTE1": {
"Id": 1,
"Route": {
"Pu1": "192.168.9.92",
"Ps1": "192.168.9.94",
"Pu2": "192.168.9.97",
"Ps2": "192.168.9.95",
"PR": "192.168.9.96"
},
"Protocols":
[
{
"name": "udp",
"not daddr": ["35.180.139.74", "1.1.1.1"],
"not dport": ["8081", "2000-2050", "3000-4000"]
}
]
},
"ROUTE2": {
"Id": 2,
"Route": {
"Pu1": "192.168.9.92",
"Ps1": "192.168.9.95",
"Ps2": "192.168.9.94",
"public_ip_country": "France"
},
"Protocols":
[
{
"name": "icmp"
},
{
"name": "tcp",
"daddr": ["8.8.8.8"],
"dport": ["8081", "2000-2050", "3000-4000"]
}
]
}
}
In the version v1.0, new configuration entry_country is introduced and the file format is modified to include version and config field.
{
"version": "1.0",
"config": {
"ROUTE1": {
"Id": 1,
"Route": {
"entry_country": "Poland",
"Ps1": "192.168.9.94",
"Ps2": "192.168.9.95",
"PR": "192.168.9.96"
},
"Protocols":
[
{
"name": "udp",
"not daddr": ["35.180.139.74", "1.1.1.1"],
"not dport": ["8081", "2000-2050", "3000-4000"]
}
]
}
}
}
Each element of json object is the configuration of a route accompanied by the data characteristics traversing through it. Each route must contain the following information.
- Id: , a non-negative interger which is unique for each route. It is also the id of the queue used by nftables to store traffic of the route.
- Route: used to specify the nodes’ ip or leaving country of the route. The following keywords are included in this field.
– Pu1, Pu2, Ps1, Ps2, PR: , ip address of the corresponding node in string format
– public_ip_country: , the country of PR node, where services see user’s traffic coming out. When using this keyword, specifying PR address is unnecessary and will be ignored.
– entry_country: , the country of Pu1 and Pu2 nodes, where user’s traffic initially arrives. When using this keyword, specifying Pu1 and Pu2 IP address is unnecessary and will be ignored.
Not all nodes’ addresses need to be specified. Missing nodes are automatically chosen randomly.
- Protocols: procotol-related configurations for each route. Mutiple configurations for diffrent protocols in a single route are supported.
– name: , transport protocol name, currently only supports tcp, udp and icmp. You can use any if you want to take all protocols.
– dport: <list>, list of all destination ports in string format are included in this route. The range of ports is also supported, which is given by the following format: “-” where the lower and upper bound are separated by ‘-’.
– daddr: <list>, list of all destination ip addresses in string format are included in this route. The range of addresses is also supported, which is given by the following format: “-” where the lower and upper bound are separated by ‘-’.
– not dport: <list>, list of all destination ports in string format are excluded in this route. The range of ports is also supported, which is given by the following format: “-” where the lower and upper bound are separated by ‘-’.
– not daddr: <list>, list of all destination ip addresses in string format are excluded in this route. The range of addresses is also supported, which is given by the following format: “-” where the lower and upper bound are separated by ‘-’.
If neither dport nor not dport are given, traffic to any ports is captured by Snowpack. This also can be done by specifying: “dport”: “any”. Same rule is applied for daddr.
Note that there is no notion of port in icmp packets, therefore, giving dport or not dport for icmp configuration is ignored.
Access info to create your own config file
You can use the following commands to get info on the existing nodes:
- In order to list only countries with online public nodes to develop your multiroutes config file
./snowpack-cli --exit_country_info
- In order to list only ips of online public nodes to develop your multiroutes config file
./snowpack-cli --public_ip_info
- In order to get all info about available nodes to develop your multiroutes config file
./snowpack-cli --nodes_info