5 |
|
|
6 |
help_network_hostname() |
help_network_hostname() |
7 |
{ |
{ |
8 |
|
mecho "get network.hostname" |
9 |
|
mecho " displays the current hostname" |
10 |
|
mecho |
11 |
mecho "set network.hostname [hostname]" |
mecho "set network.hostname [hostname]" |
12 |
|
mecho " Sets the hostname of the system" |
13 |
mecho " mcore - the local hostname" |
mecho " mcore - the local hostname" |
14 |
} |
} |
15 |
|
|
16 |
|
get_network_hostname() |
17 |
|
{ |
18 |
|
hostname |
19 |
|
} |
20 |
|
|
21 |
# set_network_hostname $value |
# set_network_hostname $value |
22 |
set_network_hostname() |
set_network_hostname() |
23 |
{ |
{ |
89 |
fi |
fi |
90 |
} |
} |
91 |
|
|
92 |
|
help_network_gateway() |
93 |
|
{ |
94 |
|
mecho "get network.gateway" |
95 |
|
mecho " displays the current network gateway" |
96 |
|
mecho |
97 |
|
mecho "set network.gateway [ip]" |
98 |
|
mecho " sets the network gateway to [ip]" |
99 |
|
} |
100 |
|
|
101 |
|
get_network_gateway() |
102 |
|
{ |
103 |
|
local gw |
104 |
|
gw=$(ip route | grep default | sed 's:.*via[[:space:]]\(.*\)[[:space:]]dev.*:\1:') |
105 |
|
echo "${gw}" |
106 |
|
} |
107 |
|
|
108 |
set_network_gateway() |
set_network_gateway() |
109 |
{ |
{ |
110 |
local value="$1" |
local value="$1" |
111 |
local CONFIG |
local CONFIG |
112 |
local i |
local i |
113 |
|
|
114 |
|
[[ -z ${value} ]] && help_network_gateway && return 1 |
115 |
|
|
116 |
CONFIG="/etc/conf.d/net.routes" |
CONFIG="/etc/conf.d/net.routes" |
117 |
clearconfig |
clearconfig |
118 |
addconfig "default gw ${value}" |
addconfig "default gw ${value}" |
125 |
route add default gw "${value}" |
route add default gw "${value}" |
126 |
} |
} |
127 |
|
|
128 |
set_network_dns() |
help_network_nameserver() |
129 |
|
{ |
130 |
|
mecho "get network.nameserver" |
131 |
|
mecho " displays the current nameserver of the system" |
132 |
|
mecho |
133 |
|
mecho "set network.dns [ip1] [ip2] .. [ipN]" |
134 |
|
mecho " adds given ips as nameserver to the system" |
135 |
|
} |
136 |
|
|
137 |
|
get_network_nameserver() |
138 |
|
{ |
139 |
|
local dns |
140 |
|
local i |
141 |
|
|
142 |
|
dns=$(grep nameserver /etc/resolv.conf | sed 's:.*[[:space:]]\(.*\):\1:g') |
143 |
|
for i in ${dns} |
144 |
|
do |
145 |
|
echo "${i}" |
146 |
|
done |
147 |
|
} |
148 |
|
|
149 |
|
set_network_nameserver() |
150 |
{ |
{ |
151 |
local values="$@" |
local values="$@" |
152 |
local CONFIG |
local CONFIG |
153 |
local i |
local i |
154 |
|
|
155 |
|
[[ -z ${values} ]] && help_network_nameserver && return 1 |
156 |
|
|
157 |
CONFIG="/etc/resolv.conf" |
CONFIG="/etc/resolv.conf" |
158 |
clearconfig |
clearconfig |
159 |
for i in ${values} |
for i in ${values} |