2019-12-10 13:03:47 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-02-03 14:55:41 +00:00
|
|
|
# Author: Xianjun Jiao
|
|
|
|
# SPDX-FileCopyrightText: 2019 UGent
|
2021-01-20 12:30:12 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2019-12-10 13:03:47 +00:00
|
|
|
if [ $# -ne 3 ]
|
|
|
|
then
|
|
|
|
echo "Please input NIC_name ch_number ip_addr as input parameter!"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
nic_name=$1
|
|
|
|
ch_number=$2
|
|
|
|
ip_addr=$3
|
|
|
|
echo $nic_name
|
|
|
|
echo $ch_number
|
|
|
|
echo $ip_addr
|
|
|
|
|
|
|
|
sudo ip link set $nic_name down
|
|
|
|
sudo iwconfig $nic_name mode ad-hoc
|
|
|
|
sudo iwconfig $nic_name essid 'sdr-ad-hoc'
|
|
|
|
sudo ip link set $nic_name up
|
|
|
|
sudo iwconfig $nic_name channel $ch_number
|
|
|
|
#sudo iwconfig $nic_name modulation 11g
|
|
|
|
#sudo iwconfig $nic_name rate 6M
|
|
|
|
sudo ifconfig $nic_name $ip_addr netmask 255.255.255.0
|
|
|
|
ifconfig
|
|
|
|
iwconfig $nic_name
|