curl -s -X 'GET' 'http://127.0.0.1:9801/api/v2/client/mp-speeder' -H 'accept: */*' -H 'Content-Type: application/json'
/var/log/mp-sdk.log and /var/log/mp-speeder.log./usr/local/bin/mp-speeder/udping -hUsage of /usr/local/bin/mp-speeder/udping:-C intping count-I stringbind interface name-c stringprobe address, IP:PORT-i durationping interval (default 1s)-l intpayload length-logLevel stringlog level, default info-o output to shell-v show version-w durationping timeout (default 1s)
-c stringprobe address, IP:PORT
Reference command: /usr/local/bin/mp-speeder/udping -C 100 -I eth0 -c 49.7.248.202:8888 -i 0.1s -l 200
Reference command: /usr/local/bin/mp-speeder/udping -C 100 -I mp_tun0 -c 49.7.248.202:8888 -i 0.1s -l 200
Reference command: iperf3 -c x.x.x.x -p 5201 -u -b 100M -B eth0
Reference command: iperf3 -c x.x.x.x -p 5201 -u -b 100M -B 192.18.0.1
curl -X 'GET' 'http://127.0.0.1:9801/api/v2/client/flowStatistics' -H 'accept: application/json' -H 'all: true'
/usr/local/bin/mp-speeder/mp_check.sh (if there is no mp_check.sh in this directory, copy the following files to this directory).Code explanation Code rewrite #!/bin/bash# Set color outputYELLOW='\\033[0;33m'GREEN='\\033[0;32m'RED='\\033[0;31m'NC='\\033[0m' # No Color# Global variable used to store the list of ENIsinterfaces=""# Function: Check whether the process is runningcheck_process() {local process_name=$1if pgrep -f "$process_name" > /dev/null; thenecho -e "${GREEN}[✓] Process $process_name is running${NC}"return 0elseecho -e "${RED}[✗] Process $process_name is not running${NC}"return 1fi}# Function: Check network interface card existence and start upcheck_interface() {local interface=$1if ip link show "$interface" &> /dev/null; thenif ip link show "$interface" | grep -q "UP"; thenecho -e "${GREEN}[✓] Network interface card $interface is started and status is normal${NC}"return 0elseecho -e "${RED}[✗] Network interface card $interface exists but not started${NC}"return 1fielseecho -e "${RED}[✗] Network interface card $interface does not exist${NC}"return 1fi}# Function: Check rp_filtercheck_rp_filter() {if sysctl net.ipv4.conf.mp_tun0.rp_filter | grep -q "net.ipv4.conf.mp_tun0.rp_filter = 1"; thenecho -e "${RED}[✗] rp_filter is not disabled${NC}"return 0elseecho -e "${GREEN}[✓] rp_filter is closed${NC}"return 1fi}# Function: Check policy-based routingcheck_policy_routing() {# Check policy rule existenceif ip rule | grep -q "from 198.18.0.1 lookup"; thenlocal table_num=$(ip rule | grep "from 198.18.0.1 lookup " | awk '{print $NF}')echo -e "${GREEN}[✓] Find policy rule: from 198.18.0.1 lookup $table_num${NC}"# Check default route in routing tableif ip route show table "$table_num" | grep -q "default dev mp_tun0"; thenecho -e "${GREEN}[✓] Correct default route exists in route table $table_num${NC}"elseecho -e "${RED}[✗] Correct default route not found in route table $table_num${NC}"return 1fielseecho -e "${RED}[✗] Policy rule not found: from 198.18.0.1${NC}"return 1fi# Check policy rule existence based on source ipfor iface in $interfaces; do# Get the IP address of the network interface cardlocal ip_addr=$(ip addr show $iface | awk '/inet / {print $2}' | cut -d/ -f1|head -n 1)if [ -z "$ip_addr" ]; thenecho -e "${YELLOW}[-] Network interface card $iface has no IP address configuration and cannot be used to speed up. Suggest checking${NC}"continuefi# Check policy rule existenceif ip rule | grep -q "from $ip_addr lookup"; thenlocal table_num=$(ip rule | grep "from $ip_addr lookup" | awk '{print $NF}')echo -e "${GREEN}[✓] Find policy rule for network interface card $iface ($ip_addr): lookup $table_num${NC}"# Check whether there is a route in routing tableif ip route show table "$table_num" | grep -q "dev $iface"; thenecho -e "${GREEN}[✓] Route table $table_num configured correctly${NC}"elseecho -e "${RED}[✗] Route not found in route table $table_num${NC}"return 1fielseecho -e "${YELLOW}[-] Policy rule for network interface card $iface ($ip_addr) not found, may affect acceleration performance, enable policy-based routing management in SDK${NC}"fidonereturn 0}# Function: check speeder statuscheck_speeder_status() {local responseresponse=$(curl -s -X 'GET' 'http://127.0.0.1:9801/api/v2/client/mp-speeder' -H 'accept: */*' -H 'Content-Type: application/json')if echo "$response" | grep -q '"ready":true'; thenecho -e "${GREEN}[✓] speeder is running and acceleration status is normal${NC}"# Extract list of ENIsinterfaces=$(echo "$response" | sed -n 's/.*"interfaces":\\[\\([^]]*\\)\\].*/\\1/p' | sed 's/"//g' | sed 's/:[0-9]*//g' | tr ',' ' ')echo -e "${GREEN}[✓] List of ENIs: $interfaces${NC}"return 0elseecho -e "${RED}[✗] speeder is not running or acceleration status is abnormal${NC}"return 1fi}# Function: Check traffic diversion rulecheck_iptables_rules() {echo "Start checking traffic diversion rule..."# Check traffic diversion ruleif iptables -L mp_route_mark -nv -t mangle | grep -q "0x1/0xf"; thenecho -e "${GREEN}[✓] Traffic diversion rule check passed${NC}"elseecho -e "${YELLOW}[-] No traffic diversion rule detected, please confirm whether it meets expectations${NC}"fireturn 0}# Function: Check L3 featurecheck_l3_functionality() {echo "Start checking L3 feature..."# Check wireguard virtual port status# /usr/local/bin/mp-speeder/wg show# interface: 09yg7kk9di# public key: ISh0Y01aQ3dig5gyuivFnQe8lxi8Sdp3epNReVIYVSI=# private key: (hidden)# listening port: 55368# peer: RzZ9m8lgMVeFzILbkfLmlM9I3ZBuGoP4hrfe78Vjzg0=# endpoint: 198.18.0.5:10001# allowed ips: 192.168.18.0/28# latest handshake: 1 minute ago# transfer: 3.66 MiB received, 17.26 MiB sent# persistent keepalive: every 15 secondslocal responseresponse=$(/usr/local/bin/mp-speeder/wg show)if echo "$response" | grep -q "latest handshake"; thenecho -e "${GREEN}[✓] wireguard virtual port status is normal${NC}"elseecho -e "${RED}[✗] wireguard virtual port status exception${NC}"return 1fi# Check the route tablelocal interface_name=$(echo "$response" | grep "interface:" | awk '{print $2}')local allowed_ips=$(echo "$response" | grep "allowed ips:" | awk '{print $3}')if [ -z "$interface_name" ] || [ -z "$allowed_ips" ]; thenecho -e "${RED}[✗] unable to get interface name or allow IP from wireguard configuration${NC}"return 1fi# Check the route tablelocal routing_tables=$(ip route)local expected_route="$allowed_ips dev $interface_name scope link"if echo "$routing_tables" | grep -q "$expected_route"; thenecho -e "${GREEN}[✓] Correct route exists in routing table: $expected_route${NC}"elseecho -e "${RED}[✗] Correct route not found in routing table: $expected_route${NC}"return 1fi# Check whether the endpoint conforms to the 198.18.x.x formatlocal endpoint=$(echo "$response" | grep "endpoint:" | awk '{print $2}')if echo "$endpoint" | grep -q "198.18."; thenecho -e "${GREEN}[✓] endpoint complies with the 198.18.x.x format${NC}"elseecho -e "${RED}[✗] endpoint does not match the 198.18.x.x format${NC}"return 1fi# Check traffic diversion rule# The following rules must exist in the output of iptables -L -nv -t mangle# The OUTPUT chain has three chains: mp_route_bypass, mp_route_mark, and mp_l3_route, and mp_route_bypass must be first.# 2. The mp_route_bypass chain must have one rule with destination as allowed_ips and target as ACCEPT# 3. The mp_l3_route chain must have one rule with destination as endpoint and target as MARKlocal mangle_rules=$(iptables -L OUTPUT -nv -t mangle)# 1. Check chain sequence in OUTPUT chainif ! echo "$mangle_rules" | grep -q "mp_route_bypass" || \\! echo "$mangle_rules" | grep -q "mp_route_mark" || \\! echo "$mangle_rules" | grep -q "mp_l3_route"; thenecho -e "${RED}[✗] Necessary chain lacks in OUTPUT chain${NC}"return 1fi# Confirm mp_route_bypass is in the first positionif ! iptables -L OUTPUT 1 -nv -t mangle | grep -q "mp_route_bypass"; thenecho -e "${RED}[✗] mp_route_bypass is not in the first position of OUTPUT chain${NC}"return 1fi# 2. Check rules in mp_route_bypass chainif ! iptables -L mp_route_bypass -nv -t mangle | grep -q "ACCEPT.*$allowed_ips"; thenecho -e "${RED}[✗] The mp_route_bypass chain lacks an ACCEPT rule for target $allowed_ips${NC}"return 1fi# 3. Check rules in mp_l3_route chainendpoint=$(echo "$endpoint" | awk -F ':' '{print $1}')if ! iptables -L mp_l3_route -nv -t mangle | grep -q "$endpoint.*MARK.*0x1/0xf"; thenecho -e "${RED}[✗] The mp_l3_route chain lacks a MARK rule for target $endpoint${NC}"return 1fiecho -e "${GREEN}[✓] iptables rules check passed${NC}"echo "L3 feature check done"return 0}# Parse command-line parameters.while [[ "$#" -gt 0 ]]; docase $1 in-h|--help)echo "Usage: $0 [options]"echo "Options:"echo " -h, --help Display help information"echo " -l, --l3-check Check L3 feature"exit 0;;-l|--l3-check)l3_check=trueshift;;*)echo -e "${RED}[✗] Unknown parameter: $1${NC}"exit 1;;esacdoneecho "Start system check..."echo "----------------------------------------"echo "1. Check process status:"# Check mp-sdk processcheck_process "mp-sdk"if [ $? -ne 0 ]; thenecho -e "\\n${RED}Check failed, stop${NC}"exit 1fi# Check mp-speeder processcheck_process "mp-speeder"if [ $? -ne 0 ]; thenecho -e "\\n${RED}Check failed, stop${NC}"exit 1fiecho -e "\\n2. Check network interface card status:"check_interface "mp_tun0"if [ $? -ne 0 ]; thenecho -e "\\n${RED}Check failed, stop${NC}"exit 1fiecho -e "\\n3. Check acceleration status:"check_speeder_statusif [ $? -ne 0 ]; thenecho -e "\\n${RED}Check failed, stop${NC}"exit 1fiecho -e "\\n4. Check rp_filter configuration:"check_rp_filterif [ $? -ne 0 ]; thenecho -e "\\n${RED}Check failed, stop${NC}"exit 1fiecho -e "\\n5. Check routing configuration:"check_policy_routingif [ $? -ne 0 ]; thenecho -e "\\n${RED}Check failed, stop${NC}"exit 1fiecho -e "\\n6. Check traffic diversion rule configuration:"check_iptables_rulesif [ $? -ne 0 ]; thenecho -e "\\n${RED}Check failed, stop${NC}"exit 1fi# If the --l3-check parameter is specified, then execute L3 feature checkif [ "$l3_check" = true ]; thenecho -e "\\n5. Check L3 feature:"check_l3_functionalityif [ $? -ne 0 ]; thenecho -e "\\n${RED}L3 feature check failed${NC}"exit 1fifiecho "----------------------------------------"echo -e "${GREEN}ALL check items are normal${NC}"exit 0
Check Item | Detailed Description | Abnormal Detection Result | Solution |
Check Process Status | - | Process not running. | 1. The SDK process is not running: It is configured for auto-start on boot. Check the service status, or you can use Systemctl restart mp-sdk.2. The mp-speeder process is not running: Check whether the acceleration API has been invoked. If not, invoke the acceleration API. |
Check NIC Status. | - | NIC exists but not started. | Check the "Check speeder status" item. |
| - | NIC not present. | Check whether the tun kernel module exists (modinfo tun). |
Check rp_filter. | - | rp_filter not disabled. | sysctl -w net.ipv4.conf.mp_tun0.rp_filter=0. |
Check Policy Routing. | - | Correct default route not found in the routing table. | Restart the SDK. |
| - | Policy rule not found. | Restart the SDK. |
Check whether source IP address-based policy rules exist. | Obtain NIC IP address. | NIC not configured with an IP address, acceleration via this NIC unavailable, check recommended. | Monitor it and no action is required. |
| Check policy rule status. | Route not found in the routing table. | Restart the SDK. |
| | Policy rule for the NIC not found, which may affect acceleration performance. Enable SDK policy routing management. | Enable SDK policy routing management. |
Check speeder Status. | - | Not running or acceleration status abnormal. | 1. Call the API to start acceleration. 2. Startup failed. Check for possible causes: datakey invalidation or network disconnection. 3. For other situations, contact Tencent Cloud Ops personnel. |
Check Traffic Steering Rules | - | Traffic steering rules not detected, confirm whether this is as expected. | 1. Confirm whether the API has been invoked to add the traffic diversion policy. 2. Addition failures are usually caused by traffic diversion rule configuration issues, such as spelling errors (such as TCP, UDP, and so on) or port numbers exceeding 65536. Check and resolve these issues yourself. 3. For other situations, contact Tencent Cloud Ops personnel. |
Check L3 Feature. | Check wireguard virtual interface status. | wireguard virtual interface status abnormal. | 1. If the wireguard virtual port is missing, which may be due to network issues or loss of connection with the controller, prioritize troubleshooting these causes. 2. For other situations, contact Tencent Cloud Ops personnel. |
| Check routing table | Correct route not found in the routing table. | 1. If a machine has a route identical to L3, an ECMP scenario should be formed, which is currently not supported. 2. For other situations, contact Tencent Cloud Ops personnel. |
| Check whether the endpoint matches the 198.18.x.x format. | endpoint does not match the 198.18.x.x format. | Contact Tencent Cloud Ops personnel. |
| Check traffic steering rules - check chain order in OUTPUT chain. | Necessary chain missing in the OUTPUT chain. | Contact Tencent Cloud Ops personnel. |
| | mp_route_bypass is not the first chain in the OUTPUT chain. | This issue is usually caused by users manually adding other rules. Please check it yourself. |
| Check traffic steering rules - check rules in mp_route_bypass chain. | The mp_route_bypass chain lacks the target ACCEPT rule. | This issue is usually caused by users manually deleting the corresponding rules. Please check it yourself. |
| Check rules in mp_l3_route chain. | The mp_l3_route chain lacks the target MARK rule. | This issue is usually caused by users manually deleting the corresponding rules. Please check it yourself. |
Reference command: curl --interface eth0 ip.sb
/usr/local/etc/mp-speeder/mp_client_extend.conf file configuration -disableCrypto to disable data encryption/decryption functionality./var/log/mp-sdk.log to see whether there is multiple occurrence of "Server started on ..." at the same time./var/log/mp-sdk.log to see whether policyRouteManagement quickly calls deactivation and enable when acceleration is turned on.フィードバック