Method for the improved access of a user to a communications network using an electronic device, where the method comprises the following steps performed in the OSI model layer 2 in a network element, where the network element is a router or switch which manages access to the communications network: a) receiving from the electronic device a OSI model layer 2 message including a network access request and an identifier of the electronic device; b) if said identifier of the electronic device is registered in an internal database of the network element as an identifier of a denied electronic device, denying network access to said electronic device and ending the method, otherwise, proceeding to step c); c) if the identifier of the electronic device is registered in the internal database as an identifier of an electronic device allowed to access the network, proceeding to step d), and otherwise, storing the identification of the electronic device in the internal database as a denied electronic device, denying network access to said electronic device and ending the method; d) receiving from the electronic device an identifier of the user and a password for said user in one or more OSI model layer 2 messages; e) if said identifier of the user is registered in the internal database as an identifier of a denied user, denying network access and ending the method, otherwise, proceeding to step f); f) authenticating the user, performing at least the following verifications: f1) verifying that the identifier of the user is registered in the internal database as an identifier of an authorized user and if the received password corresponds to the one linked to said user in the internal database; f2) verifying that the identifier of the electronic device is in the internal database as linked to said user; g) if any of the verifications performed in the authentication steps is negative, storing the identification of the user in the internal database as a denied user, denying network access to said user and ending the method; otherwise proceeding to step h); h) if a layer 2 message requesting network configuration parameters is received from the electronic device, verifying if the electronic device is registered in the internal database as a electronic device allowed to access the network; if so, proceeding to step i), and otherwise, storing the identification of the electronic device as an denied electronic device, denying network access and ending the method; i) if the verification of step h) is positive, assigning a set of network configuration parameters to the electronic device depending at least on the identifier of the electronic device and sending said set of network configuration parameters to the electronic device. a) receiving from the electronic device a OSI model layer 2 message including a network access request and an identifier of the electronic device; b) if said identifier of the electronic device is registered in an internal database of the network element as an identifier of a denied electronic device, denying network access to said electronic device and ending the method, otherwise, proceeding to step c); c) if the identifier of the electronic device is registered in the internal database as an identifier of an electronic device allowed to access the network, proceeding to step d), and otherwise, storing the identification of the electronic device in the internal database as a denied electronic device, denying network access to said electronic device and ending the method; d) receiving from the electronic device an identifier of the user and a password for said user in one or more OSI model layer 2 messages; e) if said identifier of the user is registered in the internal database as an identifier of a denied user, denying network access and ending the method, otherwise, proceeding to step f); f) authenticating the user, performing at least the following verifications: f1) verifying that the identifier of the user is registered in the internal database as an identifier of an authorized user and if the received password corresponds to the one linked to said user in the internal database; f2) verifying that the identifier of the electronic device is in the internal database as linked to said user; f1) verifying that the identifier of the user is registered in the internal database as an identifier of an authorized user and if the received password corresponds to the one linked to said user in the internal database; f2) verifying that the identifier of the electronic device is in the internal database as linked to said user; g) if any of the verifications performed in the authentication steps is negative, storing the identification of the user in the internal database as a denied user, denying network access to said user and ending the method; otherwise proceeding to step h); h) if a layer 2 message requesting network configuration parameters is received from the electronic device, verifying if the electronic device is registered in the internal database as a electronic device allowed to access the network; if so, proceeding to step i), and otherwise, storing the identification of the electronic device as an denied electronic device, denying network access and ending the method; i) if the verification of step h) is positive, assigning a set of network configuration parameters to the electronic device depending at least on the identifier of the electronic device and sending said set of network configuration parameters to the electronic device.