How to Show All NAT Tables Rules IPTABLES

How to Show All NAT Tables Rules IPTABLES

iptables -t nat -L
iptables -t nat -L -n -v | grep 'something'
iptables -t nat -L -n -v

The netstat-nat command display the natted connections on a Linux iptable firewall

yum install netstat-nat

# netstat-nat -n
To display SNAT connections, run:
# netstat-nat -S
To display DNAT connections, type:
# netstat-nat -D

List NAT 

iptables -t nat –line-numbers -L

Delete rule no 6 

iptables -t nat -D PREROUTING 6

 

How to scan HBA Vmware ESXi Vmware Power CLI

How to scan HBA Vmware ESXi Vmware Power CLI

Connect to your ESX or VCenter Server

Connect-VIServer -Server 192.168.1.10  -Protocol https -User Administrator@vsphere.local -Password P@ssw0rd

To Scan all ESXi hosts is Cluster
Get-Cluster ‘cluster name‘ | Get-VMHost  | Get-VMHostStorage -RescanAllHba

To scan single ESX  host

Get-VMHost ‘192.168.1.11‘ | Get-VMHostStorage -RescanAllHba

 

How to Bring Up a SVI Interface Cisco Switch

How to Bring Up a SVI Interface  Cisco Switch

SVI must meet all of the following conditions to transition to the full “up/up” state.

1- The VLAN must exist and be active in the VLAN database.

2- At least one switched port in the VLAN (access or trunk) must be up.

3- That port must be in the STP forwarding state.

Sometimes it is necessary to have that VLAN interface up even if there are no devices or ports using that VLAN

simply forced the VLAN into an “up/up” state.  Issuing the “no autostate” command on the VLAN interface will bring the interface up.  Basically, the command just tells the VLAN interface to ignore the above mentioned prerequisites.  Note: This command is only available in certain IOS images.

Source link 

 

How to enable ESXi SSH And ESXi Shell Using PowerCLI

How to enable ESXi SSH And ESXi Shell Using PowerCLI

Connect to the VCenter Server

 

#Connect to VCenter Server 
Connect-VIServer -Server 192.168.10.1 -Protocol https -User Administrator@vsphere.local -Password P@ssw0rd

#Now Check which serveries are running and you want to start or stop
Get-VMHost 192.168.10.11 | Get-VMHostService

Now you will get slimier  to below screen

Continue reading How to enable ESXi SSH And ESXi Shell Using PowerCLI

no “setup” command found in CentOS minimal install

no “setup” command found in CentOS minimal install

In Minimum Install this will not get install

If we got below Error, we need to install some packages to get work with setup command

[root@gkhan.in ~] setup
-bash: setup: command not found

Here we can see how to install in minimal install

yum install setuptool -y
yum install system-config-network* -y
yum install system-config-firewall* -y
yum install system-config-securitylevel-tui -y
yum install system-config-keyboard -y
yum install ntsysv -y

Now we can use the setup utility, That’s it.

Extension information saved in Elastix

Extension information saved in Elastix

cat /etc/asterisk/sip_additional.conf

 

[root@pbx asterisk]# cat /etc/asterisk/sip_additional.conf
;--------------------------------------------------------------------------------;
; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
; this file must be done via the web gui. There are alternative files to make    ;
; custom modifications, details at: http://freepbx.org/configuration_files       ;
;--------------------------------------------------------------------------------;
;


[2235]
deny=0.0.0.0/0.0.0.0
secret=P@ssw0rd
dtmfmode=rfc2833
canreinvite=no
context=from-internal
host=dynamic
trustrpid=yes
sendrpid=no
type=friend
nat=yes
port=5060
qualify=yes
qualifyfreq=3600
transport=udp
avpf=no
icesupport=no
dtlsenable=no
dtlsverify=no
dtlssetup=actpass
encryption=no
callgroup=
pickupgroup=
dial=SIP/2235
mailbox=2235@device
permit=0.0.0.0/0.0.0.0
callerid=Gkhan <2235>
callcounter=yes
faxdetect=no

 

How to get vms, with their current ips, macaddresses, networkcard types

How to get vms, with their current ips, macaddresses, networkcard types

Below are the script i got to get all VM name UUID, VLAN assigned, MAC address , IP address,Network card type.

Its export in CSV .

 

$reportedvms=New-Object System.Collections.ArrayList
$vms=get-view -viewtype virtualmachine  |Sort-Object -Property {  $_.Config.Hardware.Device |  where {$_ -is [VMware.Vim.VirtualEthernetCard]} |  Measure-Object | select -ExpandProperty Count} -Descending
 
foreach($vm in $vms){
  $reportedvm = New-Object PSObject
  Add-Member -Inputobject $reportedvm -MemberType noteProperty -name Guest -value $vm.Name
  Add-Member -InputObject $reportedvm -MemberType noteProperty -name UUID -value $($vm.Config.Uuid)
$networkcards=$vm.guest.net | ?{$_.DeviceConfigId -ne -1}
$i=0
foreach($ntwkcard in $networkcards){
Add-Member -InputObject $reportedvm -MemberType NoteProperty -Name "networkcard${i}.Network" -Value $ntwkcard.Network
Add-Member -InputObject $reportedvm -MemberType NoteProperty -Name "networkcard${i}.MacAddress" -Value $ntwkcard.Macaddress  
Add-Member -InputObject $reportedvm -MemberType NoteProperty -Name "networkcard${i}.IpAddress" -Value $($ntwkcard.IpAddress|?{$_ -like "*.*"})
Add-Member -InputObject $reportedvm -MemberType NoteProperty -Name "networkcard${i}.Device" -Value $(($vm.config.hardware.device|?{$_.key -eq $($ntwkcard.DeviceConfigId)}).gettype().name)
$i++
}
$reportedvms.add($reportedvm)|Out-Null
}
 
$reportedvms|Export-Csv C:\PCLITEST\inventry\networkcard.csv