Skip to content
Permalink
Browse files

Reset Network Config

  • Loading branch information...
NEMS Linux
NEMS Linux committed Mar 19, 2019
1 parent 74988af commit 50ef292069f3f344448d8205cc44316d92bfd6fd
Showing with 27 additions and 0 deletions.
  1. +27 −0 reset-network-manager.sh
@@ -0,0 +1,27 @@
#!/usr/bin/php
<?php
# Find out which network interfaces are configured
$uuid = array();
$conf = preg_split('/\n+/', trim(shell_exec('nmcli con')));
if (is_array($conf) && count($conf) > 0) {
foreach ($conf as $thisconf) {
$tmp = preg_split('/\s+/', trim($thisconf));
if (is_array($tmp) && count($tmp) > 0) {
foreach ($tmp as $thistmp) {
$thistmp = trim(str_replace('--','',$thistmp)); // remove any that are just --
$tmp2 = explode('-',$thistmp);
if (is_array($tmp2) && count($tmp2) > 2) {
// We've found the UUID (has more than 2 hyphens)
$uuid[] = $thistmp;
}
}
}
}
}
if (count($uuid) > 0) {
foreach ($uuid as $thisuuid) {
// remove this network interface's config
shell_exec('nmcli con delete uuid ' . $thisuuid);
}
}
?>

0 comments on commit 50ef292

Please sign in to comment.
You can’t perform that action at this time.