Initial commit
[ta/infra-ansible.git] / dev_tools / startlan.sh
diff --git a/dev_tools/startlan.sh b/dev_tools/startlan.sh
new file mode 100755 (executable)
index 0000000..ced88a4
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [ $# -le 3 ];
+then
+       echo $0 '<ip> <gw>'
+       exit 1
+fi
+
+ip l set dev ens3f0 up
+ip l add link ens3f0 name vlan40 type vlan id 40
+ip a add $1/24 dev vlan40
+ip l s vlan40 up
+ip route add default dev vlan40 via $2